fab-user
[Top][All Lists]
Advanced

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

Re: [Fab-user] How to control paramiko logging level, when using fabric?


From: Carlos García
Subject: Re: [Fab-user] How to control paramiko logging level, when using fabric?
Date: Thu, 28 Jan 2016 16:35:07 +0100

Hi Elvinas,

I just read your first email :D

I’m sorry, but I was talking about Fabric output and how to supress it. paramiko is a library that Fabric uses (from the same author), so in its docs you would find the clue. Maybe there’s also a user mailing list.

PD: Learn Fabric. Bash is fine, but Python is better to debug, better to reuse and easier to read and maintain ;)

Regards


2016-01-28 13:15 GMT+01:00 Elvinas Piliponis <address@hidden>:
Hello,

See the output example at the end of letter. At the debug level I intended to display actual remote commands fabric is executing and their output, to help with any issues during debug. 

There is no fabfile as such. This is python program, which does ton of stuff before starting executing any remote commands via Fabric.

>
you have to define fabric.state.output as stated in the docs
Can you be more specific as documentation does not provide any obvious way (for me). Meaning - setting like:
import fabric
import fabric.api
import fabric.network
.....
output['debug'] = False?

I am not a programmer, I just have to do some programming besides defining how to set environment properly. :) I would have left installer written in BASH as it was for the v1 if I did not have had to parse/create YAML config files.

Thank you


On 2016.01.28 13:00, Carlos García wrote:

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


2016-01-28 11:34 GMT+01:00 Elvinas Piliponis <address@hidden>:
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 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', '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
Thank you

--

Pagarbiai | Respectfully,

Elvinas Piliponis
Vyresnysis IT inžinierius  | Senior IT Engineer

Virtustream
Kaunas | Lithuania
Mobile: +37069807947 Skype: piktazbacila

address@hidden  |  www.virtustream.com

Keep up with Virtustream:

blog

twitter

linkedin

slideshare

youtube

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

Virtustream
Kaunas | Lithuania
Mobile: +37069807947 Skype: piktazbacila

address@hidden  |  www.virtustream.com

Keep up with Virtustream:

blog

twitter

linkedin

slideshare

youtube

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.




-- 

--

Pagarbiai | Respectfully,

Elvinas Piliponis
Vyresnysis IT inžinierius  | Senior IT Engineer

Virtustream
Kaunas | Lithuania
Mobile: +37069807947 Skype: piktazbacila

address@hidden  |  www.virtustream.com

Keep up with Virtustream:

blog

twitter

linkedin

slideshare

youtube

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.




--
Carlos García
Director de Operaciones
Tel. 695 624 167 - 902 620 100
www.stoneworksolutions.net

AVISO DE CONFIDENCIALIDAD
Tanto este mensaje como todos los posibles documentos adjuntos al mismo son confidenciales y están dirigidos exclusivamente a los destinatarios de los mismos. Por favor, si Ud no es uno de dichos destinatarios, notifíquenos este hecho y elimine el mensaje de su sistema. Queda prohibida la copia, difusión o revelación de su contenido a terceros sin el previo consentimiento por escrito del remitente. En caso contrario, vulnerarán la legislación vigente

reply via email to

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