|
From: | Carlos García |
Subject: | Re: [Fab-user] How to control paramiko logging level, when using fabric? |
Date: | Thu, 28 Jan 2016 12:00:13 +0100 |
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
Regards
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 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 <address@hidden>:
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 DEBUGHowever 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.
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
starting thread (client mode): 0x1ef5050LThank you
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', 'address@hidden'] server encrypt:['aes128-ctr', 'aes192-ctr', 'aes256-ctr', 'arcfour256', 'arcfour128', 'aes128-cbc', '3des-cbc', 'blowfish-cbc', 'cast128-cbc', 'aes192-cbc', 'aes256-cbc', 'arcfour', 'address@hidden'] client mac:['hmac-md5', 'hmac-sha1', 'address@hidden', 'hmac-sha2-256', 'hmac-sha2-512', 'hmac-ripemd160', 'address@hidden', 'hmac-sha1-96', 'hmac-md5-96'] server mac:['hmac-md5', 'hmac-sha1', 'address@hidden', 'hmac-sha2-256', 'hmac-sha2-512', 'hmac-ripemd160', 'address@hidden', 'hmac-sha1-96', 'hmac-md5-96'] client compress:['none', 'address@hidden'] server compress:['none', 'address@hidden'] 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
--
Pagarbiai | Respectfully,
Elvinas Piliponis
Vyresnysis IT inžinierius | Senior IT Engineer
Kaunas | Lithuania
Mobile: +37069807947 Skype: piktazbacila
address@hidden | www.virtustream.comKeep up with 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
address@hidden
https://lists.nongnu.org/mailman/listinfo/fab-user
--
--
Pagarbiai | Respectfully,
Elvinas Piliponis
Vyresnysis IT inžinierius | Senior IT Engineer
Kaunas | Lithuania
Mobile: +37069807947 Skype: piktazbacila
address@hidden | www.virtustream.comKeep up with 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.
[Prev in Thread] | Current Thread | [Next in Thread] |