Project

General

Profile

Revision 16a7bac7

ID16a7bac743f70ed96e704268784ccf9f9aad5bb2
Parent 20908c48
Child 454df3f9

Added by Francois POIROTTE over 14 years ago

Améliorations pour pylint.

git-svn-id: https://vigilo-dev.si.c-s.fr/svn@2593 b22e2e97-25c9-44ff-b637-2e5ceca36478

View differences:

vigigraph/controllers/error.py
5 5

  
6 6
__all__ = ['ErrorController']
7 7

  
8

  
8
# pylint: disable-msg=R0201
9 9
class ErrorController(object):
10 10
    """
11 11
    Generates error documents as and when they are required.
......
29 29
                      message=request.params.get('message', default_message))
30 30
        return values
31 31

  
32
    @expose('')
32
    @expose()
33 33
    def rrd_txt_error(self, **kwargs):
34 34
        """
35 35
        Gestion erreur rrd
vigigraph/controllers/nagiosproxy.py
34 34
                try:
35 35
                    handle = urllib2.urlopen(url, data)
36 36
                    result = handle.read()
37
                except urllib2.URLError, e:
37
                except urllib2.URLError:
38 38
                    raise
39 39
                finally:
40 40
                    if handle:
vigigraph/controllers/root.py
15 15

  
16 16
LOGGER = logging.getLogger(__name__)
17 17

  
18
# pylint: disable-msg=R0201
18 19
class RootController(BaseController):
19 20
    """
20 21
    The root controller for the vigigraph application.
vigigraph/controllers/rpc.py
1 1
# -*- coding: utf-8 -*-
2 2
"""RPC controller for the combobox of vigigraph"""
3 3

  
4
from tg import expose, response, request, redirect, config, url
5
from tg import exceptions
4
import time
5
import urllib
6
import urllib2
7
import csv
8
import logging
9

  
10
from pylons.i18n import ugettext as _
11
from tg import expose, response, request, redirect, config, url, exceptions
12
from sqlalchemy.orm import aliased
6 13

  
7 14
from vigigraph.lib.base import BaseController
8 15

  
......
17 24
from vigilo.models.tables.secondary_tables import HOST_GROUP_TABLE
18 25
from vigilo.models.tables.secondary_tables import GRAPH_GROUP_TABLE
19 26
from vigilo.models.tables.secondary_tables import GRAPH_PERFDATASOURCE_TABLE
20

  
21 27
from vigilo.models.functions import sql_escape_like
22

  
23
from sqlalchemy.orm import aliased
24 28
        
25 29
from vigilo.turbogears.rrdproxy import RRDProxy
26
from nagiosproxy import NagiosProxy
27

  
28
from pylons.i18n import ugettext as _
29

  
30
import time
31
import random
32
import urllib
33
import urllib2
34
import csv
35
import logging
36 30

  
31
from nagiosproxy import NagiosProxy
37 32
from searchhostform import SearchHostForm
38 33
from vigigraph.lib import graphs
39 34

  
......
42 37

  
43 38
__all__ = ['RpcController']
44 39

  
45

  
40
# pylint: disable-msg=R0201
46 41
class RpcController(BaseController):
47 42
    """
48 43
    Class Controleur TurboGears
......
349 344

  
350 345
        # valeurs particulieres
351 346
        direct = 1
352
        fakeIncr = random.randint(0, 9999999999)
353

  
354 347
        rrdserver = self.getRRDServer(host)
348

  
355 349
        if rrdserver is not None:
356 350
            # url
357 351
            url_web_path = config.get('rrd_web_path')
......
362 356
            try:
363 357
                result = rrdproxy.get_img_name_with_params(host, graph, \
364 358
                direct, duration, start, int(details))
365
            except urllib2.URLError, e:
359
            except urllib2.URLError:
366 360
                txt = _("Can't get RRD graph \"%s\" on host \"%s\"") \
367 361
                    % (graph, host)
368 362
                LOGGER.error(txt)
......
400 394

  
401 395
        # valeurs particulieres
402 396
        direct = 1
403
        fakeIncr = random.randint(0, 9999999999)
404

  
405 397
        rrdserver = self.getRRDServer(host)
406 398
        
407 399
        if rrdserver is not None:
......
414 406
            try:
415 407
                result = rrdproxy.get_img_with_params(host, graph, direct, \
416 408
                duration, start, int(details))
417
            except urllib2.URLError, e:
409
            except urllib2.URLError:
418 410
                txt = _("Can't get RRD graph \"%s\" on host \"%s\"") \
419 411
                    % (graph, host)
420 412
                LOGGER.error(txt)
......
451 443
        """
452 444

  
453 445
        result = None
454

  
455 446
        getstarttime = 1
456
        fakeincr = random.randint(0, 9999999999)
457

  
458 447
        rrdserver = self.getRRDServer(host)
448

  
459 449
        if rrdserver is not None:
460 450
            # url
461 451
            url_web_path = config.get('rrd_web_path')
......
465 455
            rrdproxy = RRDProxy(url_l)
466 456
            try:
467 457
                result = rrdproxy.get_starttime(host, getstarttime)
468
            except urllib2.URLError, e:
458
            except urllib2.URLError:
469 459
                txt = _("Can't get RRD data on host \"%s\"") \
470 460
                    % (host)
471 461
                LOGGER.error(txt)
......
497 487
            nagiosproxy = NagiosProxy(url_l)
498 488
            try:
499 489
                result = nagiosproxy.get_status(host)
500
            except urllib2.URLError, e:
490
            except urllib2.URLError:
501 491
                txt = _("Can't get Nagios data on host \"%s\"") \
502 492
                    % (host)
503 493
                LOGGER.error(txt)
......
532 522
            nagiosproxy = NagiosProxy(url_l)
533 523
            try:
534 524
                result = nagiosproxy.get_extinfo(host, service)
535
            except urllib2.URLError, e:
525
            except urllib2.URLError:
536 526
                txt = _("Can't get Nagios data on host \"%s\" service \"%s\"")\
537 527
                    % (host, service)
538 528
                LOGGER.error(txt)
......
567 557
            rrdproxy = RRDProxy(url_l)
568 558
            try:
569 559
                result = rrdproxy.get_hostC(host)
570
            except urllib2.URLError, e:
560
            except urllib2.URLError:
571 561
                txt = _("Can't get RRD data on host \"%s\"") \
572 562
                    % (host)
573 563
                LOGGER.error(txt)
......
727 717
                    rrdproxy = RRDProxy(url_l)
728 718
                    try:
729 719
                        result = rrdproxy.exportCSV(server=host, graph=graph, \
730
                        indicator=indicator, start=start, end=end)
731
                    except urllib2.URLError, e:
720
                            indicator=indicator, start=start, end=end)
721
                    except urllib2.URLError:
732 722
                        b_export = False
733 723
                        
734 724
                        txt = _("Can't get RRD data on host \"%s\" \
735
                        graph \"%s\" indicator \"%s\" ") \
725
                                graph \"%s\" indicator \"%s\" ") \
736 726
                        % (host, graph, indicator)
737 727
                        LOGGER.error(txt)
738 728

  
......
755 745

  
756 746
                            # fichier
757 747
                            f = open(filename, 'wt')
758
                            fn = 'attachment;filename='+filename
748
                            fn = 'attachment;filename=' + filename
759 749
                            response.headerlist.append \
760 750
                            (('Content-Disposition', fn))
761 751
                            try:
vigigraph/tests/functional/test_nagiosproxy.py
54 54
    return a
55 55

  
56 56
def create_Ventilation(host, server, application):
57
    """
58
    Peuple la base de données avec des informations sur la ventilation
59
    de la supervision, c'est-à-dire, la répartition des applications de
60
    supervision sur le parc et les machines gérées par chacune de ces
61
    applications.
62
    """
57 63
    v = None
58 64
    h = DBSession.query(Host).filter(Host.name == host).first()
59 65
    s = DBSession.query(VigiloServer).filter(

Also available in: Unified diff