mirror of
https://github.com/cupcakearmy/drone-deploy.git
synced 2024-12-22 00:06:32 +00:00
Cleaner output
This commit is contained in:
parent
85e5c7f061
commit
5fd4397f5f
9
main.py
9
main.py
@ -19,13 +19,7 @@ def execute(c: SSHClient, cmd: str, path: str = None) -> str:
|
|||||||
if path is not None:
|
if path is not None:
|
||||||
cmd = 'cd {}; {}'.format(path, cmd)
|
cmd = 'cd {}; {}'.format(path, cmd)
|
||||||
stdin, stdout, stderr = c.exec_command(cmd)
|
stdin, stdout, stderr = c.exec_command(cmd)
|
||||||
output = stdout.read().decode('utf-8').strip()
|
return stdout.read().decode('utf-8').strip()
|
||||||
error = stderr.read().decode('utf-8')
|
|
||||||
|
|
||||||
if len(error) is not 0:
|
|
||||||
print('ERROR: {}'.format(error))
|
|
||||||
|
|
||||||
return output
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
@ -103,6 +97,7 @@ def main():
|
|||||||
|
|
||||||
for command in commands:
|
for command in commands:
|
||||||
output = execute(ssh, command, target)
|
output = execute(ssh, command, target)
|
||||||
|
print(command)
|
||||||
print(output)
|
print(output)
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
|
Loading…
Reference in New Issue
Block a user