From e1cc654776d93d575550bcb995697a5aceacef0c Mon Sep 17 00:00:00 2001 From: Thomas NOEL Date: Fri, 24 Nov 2017 19:17:43 +0100 Subject: [PATCH] hobo: handle theme overlays as in hobo-agent (#20272) --- wcs/ctl/check_hobos.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/wcs/ctl/check_hobos.py b/wcs/ctl/check_hobos.py index 97aea04c..efed9d59 100644 --- a/wcs/ctl/check_hobos.py +++ b/wcs/ctl/check_hobos.py @@ -185,9 +185,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) -- 2.15.0