moved to more borg or restic exit codes solution instead of generalised
This commit is contained in:
parent
d79780b98b
commit
bba41d1225
3 changed files with 17 additions and 18 deletions
|
@ -1,10 +1,9 @@
|
||||||
import ../model/config_type
|
import ../model/config_type
|
||||||
import ../model/state_type
|
import ../model/state_type
|
||||||
import ../model/exit_codes
|
|
||||||
import ../model/tool_type
|
|
||||||
import ../notifier/notifier
|
import ../notifier/notifier
|
||||||
import ../model/log_type
|
import ../model/log_type
|
||||||
|
|
||||||
|
import exit_codes
|
||||||
import execute
|
import execute
|
||||||
import prune
|
import prune
|
||||||
|
|
||||||
|
@ -28,7 +27,7 @@ proc createArchive(nc: NorgConfig, repo: Repository, archivename: string, retry:
|
||||||
return (BORG_ERROR, "Max Retries Reached")
|
return (BORG_ERROR, "Max Retries Reached")
|
||||||
else:
|
else:
|
||||||
return createArchive(nc, repo, archivename, retry + 1)
|
return createArchive(nc, repo, archivename, retry + 1)
|
||||||
return (res.toExitCode(BORG),"Success")
|
return (res.toExitCode(),"Success")
|
||||||
|
|
||||||
proc createBackup*(nc: NorgConfig, repo: Repository): EXIT_CODE =
|
proc createBackup*(nc: NorgConfig, repo: Repository): EXIT_CODE =
|
||||||
let start_time = now()
|
let start_time = now()
|
||||||
|
|
15
norg/borg/exit_codes.nim
Normal file
15
norg/borg/exit_codes.nim
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
|
||||||
|
|
||||||
|
import std/enumutils
|
||||||
|
|
||||||
|
type
|
||||||
|
EXIT_CODE* = enum
|
||||||
|
BORG_SUCCESS = 0
|
||||||
|
BORG_WARNING = 1
|
||||||
|
BORG_ERROR = 2
|
||||||
|
OTHER = 99
|
||||||
|
|
||||||
|
proc toExitCode*(i: int): EXIT_CODE =
|
||||||
|
for code in EXIT_CODE:
|
||||||
|
if i == ord(code): return code
|
||||||
|
return OTHER
|
|
@ -1,15 +0,0 @@
|
||||||
import tool_type
|
|
||||||
|
|
||||||
import std/enumutils
|
|
||||||
|
|
||||||
type
|
|
||||||
EXIT_CODE* = enum
|
|
||||||
BORG_SUCCESS = 0
|
|
||||||
BORG_WARNING = 1
|
|
||||||
BORG_ERROR = 2
|
|
||||||
OTHER = 99
|
|
||||||
|
|
||||||
proc toExitCode*(i: int, tool: BackupTool): EXIT_CODE =
|
|
||||||
for code in EXIT_CODE:
|
|
||||||
if i == ord(code): return code
|
|
||||||
return OTHER
|
|
Loading…
Reference in a new issue