diff options
author | Frédéric Péters <fpeters@entrouvert.com> | 2020-05-15 14:03:10 (GMT) |
---|---|---|
committer | Frédéric Péters <fpeters@entrouvert.com> | 2020-05-15 14:03:10 (GMT) |
commit | 0613710ef30bc542416495c4e896301e2098ca39 (patch) | |
tree | baf8a9e42559f511a424afdb0667bf988d4b5fdc | |
parent | d3b9a8e525695602338e05950e9451305f0ba715 (diff) | |
download | misc-fred-0613710ef30bc542416495c4e896301e2098ca39.zip misc-fred-0613710ef30bc542416495c4e896301e2098ca39.tar.gz misc-fred-0613710ef30bc542416495c4e896301e2098ca39.tar.bz2 |
grandlyon: handle missing media/ directory when copying portals
-rw-r--r-- | grandlyon/scripts/copy-portal-agent.py | 5 | ||||
-rw-r--r-- | grandlyon/scripts/copy-portal-users.py | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/grandlyon/scripts/copy-portal-agent.py b/grandlyon/scripts/copy-portal-agent.py index 07a67ff..7d165ba 100644 --- a/grandlyon/scripts/copy-portal-agent.py +++ b/grandlyon/scripts/copy-portal-agent.py @@ -25,5 +25,6 @@ open('/tmp/site-export.json', 'w').write(site_export) subprocess.call(['sudo', '-u', 'combo', 'combo-manage', 'tenant_command', 'import_site', '-d', dest_site, '/tmp/site-export.json']) subprocess.call(['sudo', '-u', 'combo', 'combo-manage', 'tenant_command', 'runscript', '-d', dest_site, 'fsck-combo.py']) -if os.listdir('/var/lib/combo/tenants/%s/media/*' % orig_site): - subprocess.call(['sudo', '-u', 'combo', 'cp', '-ar', '/var/lib/combo/tenants/%s/media' % orig_site, '/var/lib/combo/tenants/%s/' % dest_site]) +orig_media_dir = '/var/lib/combo/tenants/%s/media/*' % orig_site +if os.path.exists(orig_media_dir) and os.listdir(orig_media_dir): + subprocess.call(['sudo', '-u', 'combo', 'cp', '-ar', orig_media_dir, '/var/lib/combo/tenants/%s/' % dest_site]) diff --git a/grandlyon/scripts/copy-portal-users.py b/grandlyon/scripts/copy-portal-users.py index d8de98e..fd3a8ab 100644 --- a/grandlyon/scripts/copy-portal-users.py +++ b/grandlyon/scripts/copy-portal-users.py @@ -25,5 +25,6 @@ open('/tmp/site-export.json', 'w').write(site_export) subprocess.call(['sudo', '-u', 'combo', 'combo-manage', 'tenant_command', 'import_site', '-d', dest_site, '/tmp/site-export.json']) subprocess.call(['sudo', '-u', 'combo', 'combo-manage', 'tenant_command', 'runscript', '-d', dest_site, 'fsck-combo.py']) -if os.listdir('/var/lib/combo/tenants/%s/media/' % orig_site): - subprocess.call(['sudo', '-u', 'combo', 'cp', '-ar', '/var/lib/combo/tenants/%s/media' % orig_site, '/var/lib/combo/tenants/%s/' % dest_site]) +orig_media_dir = '/var/lib/combo/tenants/%s/media/*' % orig_site +if os.path.exists(orig_media_dir) and os.listdir(orig_media_dir): + subprocess.call(['sudo', '-u', 'combo', 'cp', '-ar', orig_media_dir, '/var/lib/combo/tenants/%s/' % dest_site]) |