mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[fix] Retrieve the domain to restore only for the postinstall
This commit is contained in:
parent
85626134ef
commit
3fe92d81f7
1 changed files with 11 additions and 9 deletions
|
@ -255,15 +255,6 @@ def backup_restore(name, hooks=[], apps=[], ignore_apps=False, force=False):
|
||||||
logger.info("restoring from backup '%s' created on %s", name,
|
logger.info("restoring from backup '%s' created on %s", name,
|
||||||
time.ctime(info['created_at']))
|
time.ctime(info['created_at']))
|
||||||
|
|
||||||
# Retrieve domain from the backup
|
|
||||||
try:
|
|
||||||
with open("%s/yunohost/current_host" % tmp_dir, 'r') as f:
|
|
||||||
domain = f.readline().rstrip()
|
|
||||||
except IOError:
|
|
||||||
logger.error("unable to retrieve domain from '%s/yunohost/current_host'",
|
|
||||||
tmp_dir)
|
|
||||||
raise MoulinetteError(errno.EIO, m18n.n('backup_invalid_archive'))
|
|
||||||
|
|
||||||
# Check if YunoHost is installed
|
# Check if YunoHost is installed
|
||||||
if os.path.isfile('/etc/yunohost/installed'):
|
if os.path.isfile('/etc/yunohost/installed'):
|
||||||
msignals.display(m18n.n('yunohost_already_installed'), 'warning')
|
msignals.display(m18n.n('yunohost_already_installed'), 'warning')
|
||||||
|
@ -281,6 +272,16 @@ def backup_restore(name, hooks=[], apps=[], ignore_apps=False, force=False):
|
||||||
raise MoulinetteError(errno.EEXIST, m18n.n('restore_failed'))
|
raise MoulinetteError(errno.EEXIST, m18n.n('restore_failed'))
|
||||||
else:
|
else:
|
||||||
from yunohost.tools import tools_postinstall
|
from yunohost.tools import tools_postinstall
|
||||||
|
|
||||||
|
# Retrieve the domain from the backup
|
||||||
|
try:
|
||||||
|
with open("%s/yunohost/current_host" % tmp_dir, 'r') as f:
|
||||||
|
domain = f.readline().rstrip()
|
||||||
|
except IOError:
|
||||||
|
logger.error("unable to retrieve domain from '%s/yunohost/current_host'",
|
||||||
|
tmp_dir)
|
||||||
|
raise MoulinetteError(errno.EIO, m18n.n('backup_invalid_archive'))
|
||||||
|
|
||||||
logger.info("executing the post-install...")
|
logger.info("executing the post-install...")
|
||||||
tools_postinstall(domain, 'yunohost', True)
|
tools_postinstall(domain, 'yunohost', True)
|
||||||
|
|
||||||
|
@ -337,6 +338,7 @@ def backup_list():
|
||||||
except ValueError:
|
except ValueError:
|
||||||
continue
|
continue
|
||||||
result.append(name)
|
result.append(name)
|
||||||
|
result.sort()
|
||||||
|
|
||||||
return { 'archives': result }
|
return { 'archives': result }
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue