hobo: handle theme overlays as in hobo-agent (#20272)

This commit is contained in:
Thomas NOËL 2017-11-24 19:17:43 +01:00 committed by Frédéric Péters
parent dbfd4179f4
commit dff62a8cb7
1 changed files with 11 additions and 3 deletions

View File

@ -186,9 +186,17 @@ class CmdCheckHobos(Command):
atomic_symlink(target_dir, theme_dir)
for component in ('static', 'templates'):
component_dir = os.path.join(tenant_dir, component)
if os.path.lexists(component_dir):
os.unlink(component_dir)
if theme_data.get('overlay'):
if not os.path.islink(component_dir) and os.path.isdir(component_dir):
try:
os.rmdir(component_dir)
except OSError:
continue
if not theme_data.get('overlay'):
try:
os.unlink(component_dir)
except OSError:
pass
else:
atomic_symlink(
os.path.join(self.THEMES_DIRECTORY, theme_data['overlay'], component),
component_dir)