From ca747f8ea5ea80169eb39c62b10b0d6a517690c4 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Wed, 14 Jul 2021 12:49:07 +0200 Subject: [PATCH] Prepare snapshot -> backup migration (#50) --- src/config.schema.json | 29 +++++++++++++++++++++++------ src/lint.py | 8 ++++++++ 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/src/config.schema.json b/src/config.schema.json index 65386d3..a7e90dc 100644 --- a/src/config.schema.json +++ b/src/config.schema.json @@ -29,6 +29,23 @@ "default": false, "type": "boolean" }, + "backup": { + "default": "hot", + "enum": ["hot", "cold"], + "type": "string" + }, + "backup_exclude": { + "items": { + "type": "string" + }, + "type": "array" + }, + "backup_pre": { + "type": "string" + }, + "backup_post": { + "type": "string" + }, "boot": { "default": "auto", "enum": ["auto", "manual"], @@ -225,18 +242,18 @@ "enum": ["hot", "cold"], "type": "string" }, - "snapshot_pre": { - "type": "string" - }, - "snapshot_post": { - "type": "string" - }, "snapshot_exclude": { "items": { "type": "string" }, "type": "array" }, + "snapshot_pre": { + "type": "string" + }, + "snapshot_post": { + "type": "string" + }, "stage": { "default": "stable", "enum": ["deprecated", "experimental", "stable"], diff --git a/src/lint.py b/src/lint.py index 44e22db..9051c0c 100644 --- a/src/lint.py +++ b/src/lint.py @@ -139,6 +139,14 @@ def is_default(validator, properties, instance, schema): ) exit_code = 1 +if configuration.get("backup", "hot") == "cold": + for option in ["backup_pre", "backup_post"]: + if option in configuration: + print( + f"::error file={config}::'{option}' is not valid when using cold backups." + ) + exit_code = 1 + # Checks regarding build file(if found) for file_type in ("json", "yaml", "yml"): build = path / f"build.{file_type}"