fab-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Fab-user] hide() not working as expected


From: Ronan Amicel
Subject: Re: [Fab-user] hide() not working as expected
Date: Fri, 4 Apr 2014 17:04:08 +0200

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


On Fri, Apr 4, 2014 at 4:51 PM, Ronan Amicel <address@hidden> wrote:
> 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
>
> On Fri, Apr 4, 2014 at 7:04 AM, Naim Shahidan <address@hidden> wrote:
>> 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.
>>
>> _______________________________________________
>> Fab-user mailing list
>> address@hidden
>> https://lists.nongnu.org/mailman/listinfo/fab-user
>>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]