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))
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)
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)
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)