예제 #1
0
def restic_command(context: Context, restic: Restic, profile: Profile,
                   console: Console):
    console.info("Starting '{}'".format(restic.command))
    full_command = context.get_command_prefix() + context.get_restic_path(
    ) + " " + restic.get_command()
    shell_command(full_command, console, allow_stdin=profile.stdin)
    console.info("Finished '{}'".format(restic.command))
예제 #2
0
def cleanup_old_backups(context: Context, profile: Profile, console: Console):
    restic_retention = Restic(constants.COMMAND_FORGET)
    restic_retention.extend_arguments(profile.get_retention_flags())
    forget_command = context.get_command_prefix() + context.get_restic_path(
    ) + " " + restic_retention.get_forget_command()
    console.info("Cleaning up repository using retention information")
    shell_command(forget_command, console)
예제 #3
0
def check(context: Context, profile: Profile, console: Console):
    restic_check = Restic(constants.COMMAND_CHECK)
    restic_check.extend_arguments(
        profile.get_command_flags(constants.COMMAND_CHECK))
    check_command = context.get_command_prefix() + context.get_restic_path(
    ) + " " + restic_check.get_check_command()
    console.info("Checking repository consistency")
    shell_command(check_command, console)
예제 #4
0
def initialize_repository(context: Context, profile: Profile,
                          console: Console):
    restic_init = Restic(constants.COMMAND_INIT)
    restic_init.extend_arguments(
        profile.get_command_flags(constants.COMMAND_INIT))
    init_command = context.get_command_prefix() + context.get_restic_path(
    ) + " " + restic_init.get_init_command()
    console.info("Initializing repository (if not existing)")
    shell_command(init_command,
                  console,
                  exit_on_returncode=False,
                  display_stderr=False)