more warnings
This commit is contained in:
@ -33,9 +33,9 @@ class LogConsole:
|
|||||||
|
|
||||||
def warning(self, txt):
|
def warning(self, txt):
|
||||||
if self.colorama:
|
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:
|
else:
|
||||||
print("* " + txt)
|
print(" NOTE: " + txt)
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
|
|
||||||
def verbose(self, txt):
|
def verbose(self, txt):
|
||||||
|
|||||||
@ -150,6 +150,7 @@ class ZfsAutobackup:
|
|||||||
args.rollback = True
|
args.rollback = True
|
||||||
|
|
||||||
self.log = LogConsole(show_debug=self.args.debug, show_verbose=self.args.verbose, color=sys.stdout.isatty())
|
self.log = LogConsole(show_debug=self.args.debug, show_verbose=self.args.verbose, color=sys.stdout.isatty())
|
||||||
|
self.verbose(self.HEADER)
|
||||||
|
|
||||||
if args.resume:
|
if args.resume:
|
||||||
self.warning("The --resume option isn't needed anymore (its autodetected now)")
|
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 /")
|
self.log.error("Target should not start with a /")
|
||||||
sys.exit(255)
|
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):
|
def verbose(self, txt):
|
||||||
self.log.verbose(txt)
|
self.log.verbose(txt)
|
||||||
|
|
||||||
@ -276,6 +280,12 @@ class ZfsAutobackup:
|
|||||||
|
|
||||||
ret=[]
|
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
|
# compression
|
||||||
if self.args.compress!=None:
|
if self.args.compress!=None:
|
||||||
ret.append(ExecuteNode.PIPE)
|
ret.append(ExecuteNode.PIPE)
|
||||||
@ -283,11 +293,6 @@ class ZfsAutobackup:
|
|||||||
ret.extend(cmd)
|
ret.extend(cmd)
|
||||||
logger("zfs send compression : {}".format(" ".join(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
|
return ret
|
||||||
|
|
||||||
@ -295,12 +300,6 @@ class ZfsAutobackup:
|
|||||||
|
|
||||||
ret=[]
|
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
|
# decompression
|
||||||
if self.args.compress!=None:
|
if self.args.compress!=None:
|
||||||
cmd=compressors.decompress_cmd(self.args.compress)
|
cmd=compressors.decompress_cmd(self.args.compress)
|
||||||
@ -308,6 +307,12 @@ class ZfsAutobackup:
|
|||||||
ret.append(ExecuteNode.PIPE)
|
ret.append(ExecuteNode.PIPE)
|
||||||
logger("zfs recv decompression : {}".format(" ".join(cmd)))
|
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
|
return ret
|
||||||
|
|
||||||
# NOTE: this method also uses self.args. args that need extra processing are passed as function parameters:
|
# 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):
|
def run(self):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.verbose(self.HEADER)
|
|
||||||
|
|
||||||
if self.args.test:
|
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
|
################ create source zfsNode
|
||||||
self.set_title("Source settings")
|
self.set_title("Source settings")
|
||||||
@ -533,7 +537,7 @@ class ZfsAutobackup:
|
|||||||
|
|
||||||
if self.args.test:
|
if self.args.test:
|
||||||
self.verbose("")
|
self.verbose("")
|
||||||
self.verbose("TEST MODE - DID NOT MAKE ANY CHANGES!")
|
self.warning("TEST MODE - DID NOT MAKE ANY CHANGES!")
|
||||||
|
|
||||||
return fail_count
|
return fail_count
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user