M
M
Maxim Makhnyuk2013-04-29 11:17:52
linux
Maxim Makhnyuk, 2013-04-29 11:17:52

Blank lines in Fabric after calling any command

import fabric
from fabric.api import *

env.hosts = ['d1','d2','d3','e1','e2','e3','e4']
env.parallel = True
env.use_ssh_config = True
fabric.state.output['running'] = False

@task
def uname():
  run('uname -a')


Result:
iMac:Fabric-1.6.0 vizh$ fab uname
[e1] out: Linux e1 2.6.32-5-686 #1 SMP Sun May 6 04:01:19 UTC 2012 i686 GNU/Linux
[e1] out:
[e4] out: Linux e4 2.6.32-5-686 #1 SMP Sun May 6 04:01:19 UTC 2012 i686 GNU/Linux
[e4] out:
[e3] out: Linux e3 2.6.32-5-686 #1 SMP Sun May 6 04:01:19 UTC 2012 i686 GNU/Linux
[e3] out:
[e2] out: Linux e2 2.6.32-5-686 #1 SMP Sun May 6 04:01:19 UTC 2012 i686 GNU/Linux
[e2] out:
[d2] out: Linux d2 2.6.32-5-686-bigmem #1 SMP Sun May 6 04:39:05 UTC 2012 i686 GNU/Linux
[d2] out:
[d1] out: Linux d1 2.6.32-5-686-bigmem #1 SMP Sun May 6 04:39:05 UTC 2012 i686 GNU/Linux
[d1] out:
[d3] out: Linux d3 2.6.32-5-686-bigmem #1 SMP Sun May 6 04:39:05 UTC 2012 i686 GNU/Linux
[d3] out:

Done.


Question: how to avoid the output of empty lines, what would happen like this:

iMac:Fabric-1.6.0 vizh$ fab uname
[e1] out: Linux e1 2.6.32-5-686 #1 SMP Sun May 6 04:01:19 UTC 2012 i686 GNU/Linux
[e4] out: Linux e4 2.6.32-5-686 #1 SMP Sun May 6 04:01:19 UTC 2012 i686 GNU/Linux
[e3] out: Linux e3 2.6.32-5-686 #1 SMP Sun May 6 04:01:19 UTC 2012 i686 GNU/Linux
[e2] out: Linux e2 2.6.32-5-686 #1 SMP Sun May 6 04:01:19 UTC 2012 i686 GNU/Linux
[d2] out: Linux d2 2.6.32-5-686-bigmem #1 SMP Sun May 6 04:39:05 UTC 2012 i686 GNU/Linux
[d1] out: Linux d1 2.6.32-5-686-bigmem #1 SMP Sun May 6 04:39:05 UTC 2012 i686 GNU/Linux
[d3] out: Linux d3 2.6.32-5-686-bigmem #1 SMP Sun May 6 04:39:05 UTC 2012 i686 GNU/Linux

Done.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question