summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@entrouvert.com>2021-06-04 07:03:00 (GMT)
committerFrédéric Péters <fpeters@entrouvert.com>2021-06-04 07:08:44 (GMT)
commita1ed48f3bda1373a5ca849dbe56e20d9b1e0dba7 (patch)
treef06eeed2a3b7fe477d860fa5efc9ba786f932fee
parenta6a70d960598b62ebbc9ed8b991262ed3a6245c3 (diff)
downloadmisc-fred-a1ed48f3bda1373a5ca849dbe56e20d9b1e0dba7.zip
misc-fred-a1ed48f3bda1373a5ca849dbe56e20d9b1e0dba7.tar.gz
misc-fred-a1ed48f3bda1373a5ca849dbe56e20d9b1e0dba7.tar.bz2
grandlyon: handle wcs tenants deployed in a tenants/ subdirectory (#54180)
-rwxr-xr-xgrandlyon/scripts/copy-wcs.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/grandlyon/scripts/copy-wcs.py b/grandlyon/scripts/copy-wcs.py
index 84a7667..61ebcf6 100755
--- a/grandlyon/scripts/copy-wcs.py
+++ b/grandlyon/scripts/copy-wcs.py
@@ -38,8 +38,22 @@ def copy(orig, dest, dest_city):
fd.close()
for object_type in ('formdefs', 'workflows', 'categories', 'datasources', 'models', 'wcscalls'):
- orig_dir = os.path.join('/var/lib/wcs/%s/%s/' % (orig_site, object_type))
- dest_dir = os.path.join('/var/lib/wcs/%s/%s/' % (dest_site, object_type))
+ if os.path.exists('/var/lib/wcs/%s' % orig_site):
+ orig_base_dir = '/var/lib/wcs/%s' % orig_site
+ elif os.path.exists('/var/lib/wcs/tenants/%s' % orig_site):
+ orig_base_dir = '/var/lib/wcs/tenants/%s' % orig_site
+ else:
+ print('missing source tenant')
+ sys.exit(1)
+ if os.path.exists('/var/lib/wcs/%s' % dest_site):
+ dest_base_dir = '/var/lib/wcs/%s' % dest_site
+ elif os.path.exists('/var/lib/wcs/tenants/%s' % dest_site):
+ dest_base_dir = '/var/lib/wcs/tenants/%s' % dest_site
+ else:
+ print('missing destination tenant')
+ sys.exit(1)
+ orig_dir = os.path.join('%s/%s/' % (orig_base_dir, object_type))
+ dest_dir = os.path.join('%s/%s/' % (dest_base_dir, object_type))
if not os.path.exists(orig_dir):
continue
if not os.path.exists(dest_dir):