mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Backup / restore original appslist to handle backward case properly
This commit is contained in:
parent
e2e9a7a033
commit
93c978ba42
1 changed files with 13 additions and 7 deletions
|
@ -1,15 +1,25 @@
|
||||||
|
import os
|
||||||
|
|
||||||
from moulinette.utils.log import getActionLogger
|
from moulinette.utils.log import getActionLogger
|
||||||
from yunohost.app import app_fetchlist, app_removelist, _read_appslist_list
|
from yunohost.app import app_fetchlist, app_removelist, _read_appslist_list, APPSLISTS_JSON
|
||||||
from yunohost.tools import Migration
|
from yunohost.tools import Migration
|
||||||
|
|
||||||
logger = getActionLogger('yunohost.migration')
|
logger = getActionLogger('yunohost.migration')
|
||||||
|
|
||||||
|
BASE_CONF_PATH = '/home/yunohost.conf'
|
||||||
|
BACKUP_CONF_DIR = os.path.join(BASE_CONF_PATH, 'backup')
|
||||||
|
APPSLISTS_BACKUP = os.path.join(BACKUP_CONF_DIR, "appslist_before_migration_0009.json")
|
||||||
|
|
||||||
|
|
||||||
class MyMigration(Migration):
|
class MyMigration(Migration):
|
||||||
|
|
||||||
"Migrate from official.json to apps.json"
|
"Migrate from official.json to apps.json"
|
||||||
|
|
||||||
def migrate(self):
|
def migrate(self):
|
||||||
|
|
||||||
|
# Backup current app list json
|
||||||
|
os.system("cp %s %s") % (APPSLISTS_JSON, APPSLISTS_BACKUP)
|
||||||
|
|
||||||
# Remove all the deprecated lists
|
# Remove all the deprecated lists
|
||||||
lists_to_remove = [
|
lists_to_remove = [
|
||||||
"https://app.yunohost.org/official.json",
|
"https://app.yunohost.org/official.json",
|
||||||
|
@ -28,9 +38,5 @@ class MyMigration(Migration):
|
||||||
|
|
||||||
def backward(self):
|
def backward(self):
|
||||||
|
|
||||||
# Remove apps.json list
|
if os.path.exists(APPSLISTS_BACKUP):
|
||||||
app_removelist(name="yunohost")
|
os.system("cp %s %s") % (APPSLISTS_BACKUP, APPSLISTS_JSON)
|
||||||
|
|
||||||
# Replace by official.json list
|
|
||||||
app_fetchlist(name="yunohost",
|
|
||||||
url="https://app.yunohost.org/official.json")
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue