more warnings

This commit is contained in:
Edwin Eefting 2021-05-18 19:36:33 +02:00
parent 830ccf1bd4
commit 9264e8de6d
2 changed files with 20 additions and 16 deletions

View File

@ -33,9 +33,9 @@ class LogConsole:
def warning(self, txt):
if self.colorama:
print(colorama.Fore.YELLOW + colorama.Style.BRIGHT + "* " + txt + colorama.Style.RESET_ALL)
print(colorama.Fore.YELLOW + colorama.Style.BRIGHT + " NOTE: " + txt + colorama.Style.RESET_ALL)
else:
print("* " + txt)
print(" NOTE: " + txt)
sys.stdout.flush()
def verbose(self, txt):

View File

@ -150,6 +150,7 @@ class ZfsAutobackup:
args.rollback = True
self.log = LogConsole(show_debug=self.args.debug, show_verbose=self.args.verbose, color=sys.stdout.isatty())
self.verbose(self.HEADER)
if args.resume:
self.warning("The --resume option isn't needed anymore (its autodetected now)")
@ -162,6 +163,9 @@ class ZfsAutobackup:
self.log.error("Target should not start with a /")
sys.exit(255)
if args.compress and not args.ssh_source and not args.ssh_target:
self.warning("Using compression, but transfer is local.")
def verbose(self, txt):
self.log.verbose(txt)
@ -276,6 +280,12 @@ class ZfsAutobackup:
ret=[]
# custom pipes
for send_pipe in self.args.send_pipe:
ret.append(ExecuteNode.PIPE)
ret.extend(send_pipe.split(" "))
logger("zfs send custom pipe : {}".format(send_pipe))
# compression
if self.args.compress!=None:
ret.append(ExecuteNode.PIPE)
@ -283,11 +293,6 @@ class ZfsAutobackup:
ret.extend(cmd)
logger("zfs send compression : {}".format(" ".join(cmd)))
# custom pipes
for send_pipe in self.args.send_pipe:
ret.append(ExecuteNode.PIPE)
ret.extend(send_pipe.split(" "))
logger("zfs send custom pipe : {}".format(send_pipe))
return ret
@ -295,12 +300,6 @@ class ZfsAutobackup:
ret=[]
# custom pipes
for recv_pipe in self.args.recv_pipe:
ret.extend(recv_pipe.split(" "))
ret.append(ExecuteNode.PIPE)
logger("zfs recv custom pipe : {}".format(recv_pipe))
# decompression
if self.args.compress!=None:
cmd=compressors.decompress_cmd(self.args.compress)
@ -308,6 +307,12 @@ class ZfsAutobackup:
ret.append(ExecuteNode.PIPE)
logger("zfs recv decompression : {}".format(" ".join(cmd)))
# custom pipes
for recv_pipe in self.args.recv_pipe:
ret.extend(recv_pipe.split(" "))
ret.append(ExecuteNode.PIPE)
logger("zfs recv custom pipe : {}".format(recv_pipe))
return ret
# NOTE: this method also uses self.args. args that need extra processing are passed as function parameters:
@ -426,10 +431,9 @@ class ZfsAutobackup:
def run(self):
try:
self.verbose(self.HEADER)
if self.args.test:
self.verbose("TEST MODE - SIMULATING WITHOUT MAKING ANY CHANGES")
self.warning("TEST MODE - SIMULATING WITHOUT MAKING ANY CHANGES")
################ create source zfsNode
self.set_title("Source settings")
@ -533,7 +537,7 @@ class ZfsAutobackup:
if self.args.test:
self.verbose("")
self.verbose("TEST MODE - DID NOT MAKE ANY CHANGES!")
self.warning("TEST MODE - DID NOT MAKE ANY CHANGES!")
return fail_count