[fix] Restore current_host and use only one backup path for it

This commit is contained in:
Jérôme Lebleu 2016-04-22 14:54:41 +02:00
parent 5af988052d
commit 689b390342
3 changed files with 7 additions and 8 deletions

View file

@ -1,7 +1,4 @@
backup_dir="$1/conf/ynh/"
backup_dir_legacy="$1/yunohost/"
backup_dir="$1/conf/ynh"
sudo mkdir -p $backup_dir
sudo mkdir -p $backup_dir_legacy
sudo cp -a /etc/yunohost/current_host $backup_dir
sudo cp -a /etc/yunohost/current_host $backup_dir_legacy
sudo cp -a /etc/yunohost/current_host "${backup_dir}/current_host"

View file

@ -1 +1,3 @@
backup_dir="$1/conf/ynh"
sudo cp -a "${backup_dir}/current_host" /etc/yunohost/current_host

View file

@ -375,11 +375,11 @@ def backup_restore(auth, name, hooks=[], ignore_hooks=False,
else:
# Retrieve the domain from the backup
try:
with open("%s/yunohost/current_host" % tmp_dir, 'r') as f:
with open("%s/conf/ynh/current_host" % tmp_dir, 'r') as f:
domain = f.readline().rstrip()
except IOError:
logger.debug("unable to retrieve domain from "
"'%s/yunohost/current_host'", tmp_dir, exc_info=1)
logger.debug("unable to retrieve current_host from the backup",
exc_info=1)
raise MoulinetteError(errno.EIO, m18n.n('backup_invalid_archive'))
logger.debug("executing the post-install...")