instead of having a pre established pre, play and post now its just a list of tasks
This commit is contained in:
@@ -1,34 +0,0 @@
|
||||
# borg actions registry
|
||||
from playbook.action_registry import ActionRegistry
|
||||
from playbook.models import StepLog, Status
|
||||
|
||||
borgact = ActionRegistry("borg_actions_reg")
|
||||
|
||||
@borgact.register(name="pre", version="preborg1.0")
|
||||
def pre(ctx, name) -> StepLog:
|
||||
log: StepLog = StepLog(
|
||||
step_name=name,
|
||||
status=Status.GOOD,
|
||||
msg="source directory exists",
|
||||
)
|
||||
return log
|
||||
|
||||
|
||||
@borgact.register(name="play", version="playborg1.0")
|
||||
def play(ctx, name) -> StepLog:
|
||||
log: StepLog = StepLog(
|
||||
step_name=name,
|
||||
status=Status.GOOD,
|
||||
msg="directory was copied/movied/borged/rsynced",
|
||||
)
|
||||
return log
|
||||
|
||||
|
||||
@borgact.register(name="post", version="postborg1.0")
|
||||
def post(ctx, name) -> StepLog:
|
||||
log: StepLog = StepLog(
|
||||
step_name=name,
|
||||
status=Status.GOOD,
|
||||
msg="copied/movied/borged/rsynced exists and is valid",
|
||||
)
|
||||
return log
|
||||
@@ -0,0 +1,54 @@
|
||||
# borg actions registry
|
||||
from playbook.action_registry import ActionRegistry
|
||||
from playbook.models import StepLog, Status
|
||||
|
||||
|
||||
restic = ActionRegistry("restic_actions_reg")
|
||||
|
||||
|
||||
@restic.register(name="check_repo_exists", version="preborg1.0")
|
||||
def check_repo_exists(ctx, name) -> StepLog:
|
||||
passwordFile: str = ctx["passwordFile"]
|
||||
repoPath: str = ctx["repoPath"]
|
||||
|
||||
if passwordFile == "":
|
||||
return StepLog(
|
||||
step_name=name,
|
||||
status=Status.BAD,
|
||||
error=["password file variable is empty"],
|
||||
)
|
||||
|
||||
if repoPath == "":
|
||||
return StepLog(
|
||||
step_name=name,
|
||||
status=Status.BAD,
|
||||
error=["password file variable is empty"]
|
||||
)
|
||||
|
||||
# If the path doesn't exist restic will make sure of warning us about it
|
||||
|
||||
return StepLog(
|
||||
step_name=name,
|
||||
status=Status.GOOD,
|
||||
msg="password file variable is empty",
|
||||
)
|
||||
|
||||
|
||||
@restic.register(name="backup_data_to_repo", version="playborg1.0")
|
||||
def backup_data_to_repo(ctx, name) -> StepLog:
|
||||
log: StepLog = StepLog(
|
||||
step_name=name,
|
||||
status=Status.GOOD,
|
||||
msg="directory was copied/movied/borged/rsynced",
|
||||
)
|
||||
return log
|
||||
|
||||
|
||||
@restic.register(name="post", version="postborg1.0")
|
||||
def validate_data_backup(ctx, name) -> StepLog:
|
||||
log: StepLog = StepLog(
|
||||
step_name=name,
|
||||
status=Status.GOOD,
|
||||
msg="copied/movied/borged/rsynced exists and is valid",
|
||||
)
|
||||
return log
|
||||
Reference in New Issue
Block a user