Hi Elvinas,
What kind of output do you want to supress? If you want only the commands
run by your fabfile, hide everything but running.
Anyway, I think this code
fabric.api.hide('everything')
fabric.api.show('running', 'user', 'output', 'stdout', 'stderr',
'warnings', 'aborts', 'status')
doesn’t work as you expected. My advise, use a context manager on your
fabfile to test it:
import fabric
def your_task()
with fabric.api.settings(fabric.api.hide('everything'),fabric.api.show
('running')):
...
<your code>
...
If you want to use this setting globally, you have to define
fabric.state.output as stated in the docs
<http://docs.fabfile.org/en/1.10/usage/output_controls.html#hiding-and-or-showing-output-levels>
Regards
2016-01-28 11:34 GMT+01:00 Elvinas Piliponis <
[email protected]>:
> Hello,
>
> Unfortunately it does not. If I set globally (I suppose)
>
> fabric.api.hide('everything')
> fabric.api.show('running', 'user', 'output', 'stdout', 'stderr',
> 'warnings', 'aborts', 'status')
>
> I still see this SSH noise. It is not coming from Fabric itself. It is
> paramiko, which somehow still catches global DEBUG level.
>
> It is not critical, but it generates around 20 lines of noise output for
> 1 relelvant message, like
> [10.193.31.52] run: [ ! -d /usr/local/share/xstream/puppet ] && mkdir
> -p /usr/local/share/xstream/puppet || true
> And for less experienced users (which we intend to give this installer)
> such information line is lost :)
>
>
>
> Thank you
>
>
> On 2016.01.28 11:50, Carlos García wrote:
>
> Hi Elvinas,
>
> read Managing output
> <http://docs.fabfile.org/en/1.10/usage/output_controls.html> section in
> Fabric docs. I’m sure you will find what you need.
>
> I use context managers to hide sensitive information:
>
> with fabric.api.settings(
> fabric.api.hide('everything'),
> fabric.api.show ('running', 'user', 'output')):
>
> but you can configure it globally.
>
> Hope it helps
>
> Regards
>
>
> 2016-01-28 10:45 GMT+01:00 Elvinas Piliponis <
> [email protected]>:
>
>> Hello,
>>
>> I am using Fabric to write our internal product deployment utility and
>> having trouble supressing paramiko SSH output, when using DEBUG level. Is
>> it possible to cut off messages like in the example below?
>>
>> If I set global logging level to INFO, these messages are not printed,
>> however it also hides debug level messages from the installer, which I want
>> to print out.
>>
>> I have tried to setup different levels of logging output.
>>
>> if debug:
>> logging.getLogger('paramiko').setLevel(LEVELS.get('info',
>> logging.NOTSET))
>> logging.getLogger('requests').setLevel(LEVELS.get('info',
>> logging.NOTSET))
>>
>>
>> It seems to be set up properly, according to logging_tree (
>> https://pypi.python.org/pypi/logging_tree) output:
>>
>> Level DEBUG
>> Handler File '/home/xstack/git/installxstream/xsdeploy.log'
>> Formatter <logging.Formatter instance at 0x1d17ef0>
>> Handler Stream <open file '<stdout>', mode 'w' at 0x7f5e520a9150>
>> Level DEBUG
>> |
>> o<--"paramiko"
>> | Level INFO
>> |
>> o<--"requests"
>> Level INFO
>> Handler <requests.NullHandler instance at 0x1b3e2d8>
>> |
>> o<--[requests.packages]
>> |
>> o<--"requests.packages.urllib3"
>> Level NOTSET so inherits level INFO
>> Handler <requests.packages.urllib3.NullHandler instance at
>> 0x1b3e248>
>> |
>> o<--"requests.packages.urllib3.connectionpool"
>> | Level NOTSET so inherits level INFO
>> |
>> o<--"requests.packages.urllib3.poolmanager"
>> | Level NOTSET so inherits level INFO
>> |
>> o<--[requests.packages.urllib3.util]
>> |
>> o<--"requests.packages.urllib3.util.retry"
>> Level NOTSET so inherits level INFO
>>
>> However at DEBUG level I still get tons of SSH connection noise, which is
>> of no interest for out usage case. I am not intending to debug SSH
>> connection, when enabling debug level for software product installer.
>>
>> starting thread (client mode): 0x1ef5050L
>> Connected (version 2.0, client OpenSSH_5.3)
>> kex algos:['diffie-hellman-group-exchange-sha256',
>> 'diffie-hellman-group-exchange-sha1', 'diffie-hellman-group14-sha1',
>> 'diffie-hellman-group1-sha1'] server key:['ssh-rsa', 'ssh-dss'] client
>> encrypt:['aes128-ctr', 'aes192-ctr', 'aes256-ctr', 'arcfour256',
>> 'arcfour128', 'aes128-cbc', '3des-cbc', 'blowfish-cbc', 'cast128-cbc',
>> 'aes192-cbc', 'aes256-cbc', 'arcfour', '[email protected]']
>> server encrypt:['aes128-ctr', 'aes192-ctr', 'aes256-ctr', 'arcfour256',
>> 'arcfour128', 'aes128-cbc', '3des-cbc', 'blowfish-cbc', 'cast128-cbc',
>> 'aes192-cbc', 'aes256-cbc', 'arcfour', '[email protected]']
>> client mac:['hmac-md5', 'hmac-sha1', ' <[email protected]>
>> [email protected]', 'hmac-sha2-256', 'hmac-sha2-512',
>> 'hmac-ripemd160', ' <[email protected]>
>> [email protected]', 'hmac-sha1-96', 'hmac-md5-96'] server
>> mac:['hmac-md5', 'hmac-sha1', '[email protected]', 'hmac-sha2-256',
>> 'hmac-sha2-512', 'hmac-ripemd160', ' <[email protected]>
>> [email protected]', 'hmac-sha1-96', 'hmac-md5-96'] client
>> compress:['none', '[email protected]'] server compress:['none', '
>> [email protected]'] client lang:[''] server lang:[''] kex follows?False
>> Ciphers agreed: local=aes128-ctr, remote=aes128-ctr
>> using kex diffie-hellman-group1-sha1; server key type ssh-rsa; cipher:
>> local aes128-ctr, remote aes128-ctr; mac: local hmac-sha1, remote
>> hmac-sha1; compression: local none, remote none
>>
>> Thank you
>>
>> --
>>
>> Pagarbiai *|* Respectfully,
>>
>> *Elvinas Piliponis*
>> *Vyresnysis IT inžinierius | Senior IT Engineer*
>>
>> [image: Virtustream] <http://www.virtustream.com/>
>> <http://www.virtustream.com/>
>> Kaunas *| *Lithuania
>> Mobile: +37069807947 Skype: piktazbacila
>> [email protected] *|* www.virtustream.com
>>
>> *Keep up with Virtustream:*
>>
>> [image: blog] <http://www.virtustream.com/blog/>
>>
>> [image: twitter] <http://twitter.com/#%21/virtustream>
>>
>> [image: linkedin] <http://www.linkedin.com/company/virtustream>
>>
>> [image: slideshare] <http://www.slideshare.net/Virtustream>
>>
>> [image: youtube] <http://www.youtube.com/user/Virtustream>
>>
>> *The information contained in this electronic mail transmission may be
>> privileged and confidential, and therefore, protected **from disclosure.*
>> If you have received this communication in error, please notify us
>> immediately by replying to this message and deleting the email and its
>> attachments from all computers without copying or disclosing it.
>>
>> _______________________________________________
>> Fab-user mailing list
>> [email protected]
>> https://lists.nongnu.org/mailman/listinfo/fab-user
>>
>>
>
>
> --
>
>
> --
>
> Pagarbiai *|* Respectfully,
>
> *Elvinas Piliponis*
> *Vyresnysis IT inžinierius | Senior IT Engineer*
>
> [image: Virtustream] <http://www.virtustream.com/>
> <http://www.virtustream.com/>
> Kaunas *| *Lithuania
> Mobile: +37069807947 Skype: piktazbacila
> <[email protected]>[email protected] *|*
> www.virtustream.com
>
> *Keep up with Virtustream:*
>
> [image: blog] <http://www.virtustream.com/blog/>
> <http://www.virtustream.com/blog/>
>
> [image: twitter] <http://twitter.com/#%21/virtustream>
> <http://twitter.com/#%21/virtustream>
>
> [image: linkedin] <http://www.linkedin.com/company/virtustream>
> <http://www.linkedin.com/company/virtustream>
>
> [image: slideshare] <http://www.slideshare.net/Virtustream>
> <http://www.slideshare.net/Virtustream>
>
> [image: youtube] <http://www.youtube.com/user/Virtustream>
> <http://www.youtube.com/user/Virtustream>
>
> *The information contained in this electronic mail transmission may be
> privileged and confidential, and therefore, protected **from disclosure.*
> If you have received this communication in error, please notify us
> immediately by replying to this message and deleting the email and its
> attachments from all computers without copying or disclosing it.
>
--
_______________________________________________
Fab-user mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/fab-user