grandlyon: handle wcs tenants deployed in a tenants/ subdirectory (#54180)

This commit is contained in:
Frédéric Péters 2021-06-04 09:03:00 +02:00
parent a6a70d9605
commit a1ed48f3bd
1 changed files with 16 additions and 2 deletions

View File

@ -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):