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