Discussion:
[Fab-user] hide() not working as expected
Naim Shahidan
2014-04-04 05:04:34 UTC
Permalink
Hi guys,

im building a SSH dispatcher python script using Fabric module. Im using
fabric.contex_manager to hide running and status message.


But went i try to run the script, status message keep showing even though i
use hide().

=========== code snippet ==================

def letsdoit():
with settings(*hide('status', 'running')*):
for server_name in deco_name:
mydeco(server_name, host[i])





============== OUTPUT ======================

##########LOCALHOST###########
current date:
[localhost] out: Fri Apr 4 12:57:41 MYT 2014
[localhost] out:
system information:
[localhost] out: Linux shad0w 3.2.0-4-amd64 #1 SMP Debian 3.2.41-2 x86_64
GNU/Linux
[localhost] out:
##########MYSERVER###########
current date:
[192.168.1.11] out: Fri Apr 4 12:57:59 MYT 2014
[192.168.1.11] out:
system information:
[192.168.1.11] out: Linux modsec-dev-patchstore 3.11.0-15-generic
#25~precise1-Ubuntu SMP Thu Jan 30 17:39:31 UTC 2014 x86_64 x86_64 x86_64
GNU/Linux
[192.168.1.11] out:

Done.
*Disconnecting from 192.168.1.11... done. # status still showing*
*Disconnecting from localhost... done.*


can someone kindly tell me whats going on?



regards,
Naim S.
Ronan Amicel
2014-04-04 14:51:40 UTC
Permalink
Hi Naim,

It looks like you want to hide the output of the commands that you're running.

Try hiding the 'stdout' output level to get that behavior:

with hide('status', 'running', 'stdout'):
# ...

See http://docs.fabfile.org/en/1.8/usage/output_controls.html

Regards,

Ronan Amicel
Post by Naim Shahidan
Hi guys,
im building a SSH dispatcher python script using Fabric module. Im using
fabric.contex_manager to hide running and status message.
But went i try to run the script, status message keep showing even though i
use hide().
=========== code snippet ==================
mydeco(server_name, host[i])
============== OUTPUT ======================
##########LOCALHOST###########
[localhost] out: Fri Apr 4 12:57:41 MYT 2014
[localhost] out: Linux shad0w 3.2.0-4-amd64 #1 SMP Debian 3.2.41-2 x86_64
GNU/Linux
##########MYSERVER###########
[192.168.1.11] out: Fri Apr 4 12:57:59 MYT 2014
[192.168.1.11] out: Linux modsec-dev-patchstore 3.11.0-15-generic
#25~precise1-Ubuntu SMP Thu Jan 30 17:39:31 UTC 2014 x86_64 x86_64 x86_64
GNU/Linux
Done.
Disconnecting from 192.168.1.11... done. # status still showing
Disconnecting from localhost... done.
can someone kindly tell me whats going on?
regards,
Naim S.
_______________________________________________
Fab-user mailing list
https://lists.nongnu.org/mailman/listinfo/fab-user
Ronan Amicel
2014-04-04 15:04:08 UTC
Permalink
Sorry, I think I misunderstood your question.

You want to disable the status information that appears at the end of
the Fabric run.

The context manager has no effect, as it applies locally.

What you want is to globally disable the 'status' output level. Here
is an example:

from fabric.api import hide, run
from fabric.state import output

output['status'] = False

def foo():
with hide('running'):
run('hostname')

Alternatively, you could also add '--hide=status' to your fab command line.

Hope this helps,

Ronan Amicel
Post by Ronan Amicel
Hi Naim,
It looks like you want to hide the output of the commands that you're running.
# ...
See http://docs.fabfile.org/en/1.8/usage/output_controls.html
Regards,
Ronan Amicel
Post by Naim Shahidan
Hi guys,
im building a SSH dispatcher python script using Fabric module. Im using
fabric.contex_manager to hide running and status message.
But went i try to run the script, status message keep showing even though i
use hide().
=========== code snippet ==================
mydeco(server_name, host[i])
============== OUTPUT ======================
##########LOCALHOST###########
[localhost] out: Fri Apr 4 12:57:41 MYT 2014
[localhost] out: Linux shad0w 3.2.0-4-amd64 #1 SMP Debian 3.2.41-2 x86_64
GNU/Linux
##########MYSERVER###########
[192.168.1.11] out: Fri Apr 4 12:57:59 MYT 2014
[192.168.1.11] out: Linux modsec-dev-patchstore 3.11.0-15-generic
#25~precise1-Ubuntu SMP Thu Jan 30 17:39:31 UTC 2014 x86_64 x86_64 x86_64
GNU/Linux
Done.
Disconnecting from 192.168.1.11... done. # status still showing
Disconnecting from localhost... done.
can someone kindly tell me whats going on?
regards,
Naim S.
_______________________________________________
Fab-user mailing list
https://lists.nongnu.org/mailman/listinfo/fab-user
Naim Shahidan
2014-04-04 15:13:10 UTC
Permalink
Hi Ronan,

i want to remove only this lines in my output.
Post by Naim Shahidan
Disconnecting from 192.168.1.11... done.
Disconnecting from localhost... done.
i tried to hide stdout but all the output lines are gone. Only by using
--hide, i manage to hide 'Disconnecting from..' lines like this:
--hide status,running.


But from the script, using context_manager.settings, i cant get it right.


regards,
Naim S.
Post by Naim Shahidan
Hi Naim,
It looks like you want to hide the output of the commands that you're running.
# ...
See http://docs.fabfile.org/en/1.8/usage/output_controls.html
Regards,
Ronan Amicel
Post by Naim Shahidan
Hi guys,
im building a SSH dispatcher python script using Fabric module. Im using
fabric.contex_manager to hide running and status message.
But went i try to run the script, status message keep showing even
though i
Post by Naim Shahidan
use hide().
=========== code snippet ==================
mydeco(server_name, host[i])
============== OUTPUT ======================
##########LOCALHOST###########
[localhost] out: Fri Apr 4 12:57:41 MYT 2014
[localhost] out: Linux shad0w 3.2.0-4-amd64 #1 SMP Debian 3.2.41-2 x86_64
GNU/Linux
##########MYSERVER###########
[192.168.1.11] out: Fri Apr 4 12:57:59 MYT 2014
[192.168.1.11] out: Linux modsec-dev-patchstore 3.11.0-15-generic
#25~precise1-Ubuntu SMP Thu Jan 30 17:39:31 UTC 2014 x86_64 x86_64 x86_64
GNU/Linux
Done.
Disconnecting from 192.168.1.11... done. # status still showing
Disconnecting from localhost... done.
can someone kindly tell me whats going on?
regards,
Naim S.
_______________________________________________
Fab-user mailing list
https://lists.nongnu.org/mailman/listinfo/fab-user
Naim Shahidan
2014-04-04 15:20:39 UTC
Permalink
Thanks Ronan, it worked like a charm!


regards,
Naim S.
Post by Naim Shahidan
Hi Ronan,
i want to remove only this lines in my output.
Post by Naim Shahidan
Disconnecting from 192.168.1.11... done.
Disconnecting from localhost... done.
i tried to hide stdout but all the output lines are gone. Only by using
--hide status,running.
But from the script, using context_manager.settings, i cant get it right.
regards,
Naim S.
Post by Naim Shahidan
Hi Naim,
It looks like you want to hide the output of the commands that you're running.
# ...
See http://docs.fabfile.org/en/1.8/usage/output_controls.html
Regards,
Ronan Amicel
Post by Naim Shahidan
Hi guys,
im building a SSH dispatcher python script using Fabric module. Im using
fabric.contex_manager to hide running and status message.
But went i try to run the script, status message keep showing even
though i
Post by Naim Shahidan
use hide().
=========== code snippet ==================
mydeco(server_name, host[i])
============== OUTPUT ======================
##########LOCALHOST###########
[localhost] out: Fri Apr 4 12:57:41 MYT 2014
[localhost] out: Linux shad0w 3.2.0-4-amd64 #1 SMP Debian 3.2.41-2
x86_64
Post by Naim Shahidan
GNU/Linux
##########MYSERVER###########
[192.168.1.11] out: Fri Apr 4 12:57:59 MYT 2014
[192.168.1.11] out: Linux modsec-dev-patchstore 3.11.0-15-generic
#25~precise1-Ubuntu SMP Thu Jan 30 17:39:31 UTC 2014 x86_64 x86_64
x86_64
Post by Naim Shahidan
GNU/Linux
Done.
Disconnecting from 192.168.1.11... done. # status still showing
Disconnecting from localhost... done.
can someone kindly tell me whats going on?
regards,
Naim S.
_______________________________________________
Fab-user mailing list
https://lists.nongnu.org/mailman/listinfo/fab-user
Loading...