What hides Fabric'a ("all")?

When I use the context manager hide("everything")and the tissue problem stops working, I still get the message. docs :

that's all . Includes warnings, start, user and exit (see above). Thus, when you turn off everything, you will see only the minimum output (only status and debugging, if enabled), as well as your own print statements. A.

But this is not entirely true, right? - I see messages about status, debugging and interruption.

If I really want to hide everything, there is a better way than:

with hide("aborts"), hide("everything"):
    ...
+4
source share
2 answers

If in doubt, look at the source:

https://github.com/fabric/fabric/blob/master/fabric/context_managers.py#L98

. everything - : warnings, running, user, output, exceptions

https://github.com/fabric/fabric/blob/master/fabric/state.py#L411

output. , , , :

@task
def task1():
    with hide('running', 'stdout', 'stderr'):
        run('ls /var/www')
        ....

.

@task
def task1():
    output['running'] = False
    output['stdout'] = False
    output['stderr'] = False
    # or just output['everything'] = False
    run('ls /var/www')
    ....

, .

+4

, :

from fabric.state import output

output['everything'] = False
0

Source: https://habr.com/ru/post/1621992/


All Articles