forked from third-party-mirrors/zfs_autobackup
wip
This commit is contained in:
parent
c4bbce6fda
commit
47337d5706
@ -326,6 +326,27 @@ class ExecuteNode:
|
|||||||
else:
|
else:
|
||||||
return(self.ssh_to)
|
return(self.ssh_to)
|
||||||
|
|
||||||
|
def parse_stdout(self, line):
|
||||||
|
"""parse stdout. can be overridden in subclass"""
|
||||||
|
if self.debug_output:
|
||||||
|
self.debug("STDOUT > "+line.rstrip())
|
||||||
|
|
||||||
|
|
||||||
|
def parse_stderr(self, line, hide_errors):
|
||||||
|
"""parse stderr. can be overridden in subclass"""
|
||||||
|
if hide_errors:
|
||||||
|
self.debug("STDERR > "+line.rstrip())
|
||||||
|
else:
|
||||||
|
self.error("STDERR > "+line.rstrip())
|
||||||
|
|
||||||
|
def parse_stderr_pipe(self, line, hide_errors):
|
||||||
|
"""parse stderr from pipe input process. can be overridden in subclass"""
|
||||||
|
if hide_errors:
|
||||||
|
self.debug("STDERR|> "+line.rstrip())
|
||||||
|
else:
|
||||||
|
self.error("STDERR|> "+line.rstrip())
|
||||||
|
|
||||||
|
|
||||||
def run(self, cmd, input=None, tab_split=False, valid_exitcodes=[ 0 ], readonly=False, hide_errors=False, pipe=False):
|
def run(self, cmd, input=None, tab_split=False, valid_exitcodes=[ 0 ], readonly=False, hide_errors=False, pipe=False):
|
||||||
"""run a command on the node
|
"""run a command on the node
|
||||||
|
|
||||||
@ -404,26 +425,19 @@ class ExecuteNode:
|
|||||||
line=p.stdout.readline()
|
line=p.stdout.readline()
|
||||||
if line!="":
|
if line!="":
|
||||||
output_lines.append(line.rstrip())
|
output_lines.append(line.rstrip())
|
||||||
if self.debug_output:
|
self.parse_stdout(line)
|
||||||
self.debug("STDOUT > "+line.rstrip())
|
|
||||||
else:
|
else:
|
||||||
eof_count=eof_count+1
|
eof_count=eof_count+1
|
||||||
if p.stderr in read_ready:
|
if p.stderr in read_ready:
|
||||||
line=p.stderr.readline()
|
line=p.stderr.readline()
|
||||||
if line!="":
|
if line!="":
|
||||||
if hide_errors:
|
self.parse_stderr(line, hide_errors)
|
||||||
self.debug("STDERR > "+line.rstrip())
|
|
||||||
else:
|
|
||||||
self.error("STDERR > "+line.rstrip())
|
|
||||||
else:
|
else:
|
||||||
eof_count=eof_count+1
|
eof_count=eof_count+1
|
||||||
if isinstance(input, subprocess.Popen) and (input.stderr in read_ready):
|
if isinstance(input, subprocess.Popen) and (input.stderr in read_ready):
|
||||||
line=input.stderr.readline()
|
line=input.stderr.readline()
|
||||||
if line!="":
|
if line!="":
|
||||||
if hide_errors:
|
self.parse_stderr_pipe(line, hide_errors)
|
||||||
self.debug("STDERR|> "+line.rstrip())
|
|
||||||
else:
|
|
||||||
self.error("STDERR|> "+line.rstrip())
|
|
||||||
else:
|
else:
|
||||||
eof_count=eof_count+1
|
eof_count=eof_count+1
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user