Project

General

Profile

Revision 5dbfa80d

ID5dbfa80d7249676b39841fb1260818d2a49979a1
Parent bfd8ead8
Child 12163111

Added by Francois POIROTTE over 14 years ago

Remplacement des fichiers de configuration Python (settings.py) en fichiers INI (settings.ini), resp. pour les settings de test.
Correction des dépendances entre les composants (vigiboard -> vigilo.turbogears -> vigilo.models) et sur les bibliothèques.
Réintégration de la configuration de SQLAlchemy dans les fichiers INI de Turbogears.
Mise à jour de la configuration du corrélateur à titre d'exemple.
La manière de configurer les loggers a RADICALEMENT changée !! Lisez les settings du corrélateur pour un exemple.

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

View differences:

MANIFEST.in
1 1
recursive-include vigiboard/i18n *
2
recursive-include vigiboard/public *
3
include deployment/vigiboard.ini
4
include deployment/vigiboard.wsgi
5
include deployment/vigiboard.conf
deployment/rpm_install
1
python setup.py install --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES
2
ln -f -s /etc/vigilo/vigiboard/vigiboard.conf /etc/httpd/conf/webapps.d
deployment/settings.ini
1
;
2
; vigiboard - Pylons development environment configuration
3
;
4
; The %(here)s variable will be replaced with the parent directory of this file
5
;
6
; This file is for deployment specific config options -- other configuration
7
; that is always required for the app is done in the config directory, 
8
; and generally should not be modified by end users. 
9

  
10
[DEFAULT]
11
debug = false
12
; Uncomment and replace with the address which should receive any error reports
13
;email_to = you@yourdomain.com
14
smtp_server = localhost
15
error_email_from = paste@localhost
16

  
17
[server:main]
18
use = egg:Paste#http
19
host = 127.0.0.1 
20
port = 8080
21

  
22
[app:main]
23
use = egg:vigiboard
24

  
25
db_basename=
26
password_hashing_function=md5
27
lang=fr
28
use_kerberos=False
29

  
30
; Nombre d'événements par page.
31
vigiboard_items_per_page = 15
32

  
33
; URL vers laquelle le logo de Vigilo redirige.
34
vigiboard_links.logo = /
35

  
36
; Ordre de tri pour la priorité des événements.
37
; - Utiliser "asc" si la priorité est inversement proportionnelle à sa
38
;   valeur (ie: plus le nombre est bas, plus la priorité est élevée).
39
; - Utiliser "desc" si la priorité est proportionnelle à sa valeur
40
;   (ie: plus le nombre est élevé, plus la priorité est élevée).
41
; NE PAS METTRE DE GUILLEMETS/APOSTROPHES AUTOUR DE LA VALEUR.
42
vigiboard_priority_order = asc
43

  
44
; Default font size, must be a valid size as per the CSS 2.1 specification.
45
; See http://www.w3.org/TR/CSS21/fonts.html#font-size-props
46
vigiboard_font.size = 10px
47

  
48
full_stack = true
49
cache_dir = /tmp/vigilo/vigiboard/data
50
beaker.session.key = vigiboard
51
beaker.session.secret = somesecret
52

  
53
; If you'd like to fine-tune the individual locations of the cache data dirs
54
; for the Cache data, or the Session saves, un-comment the desired settings
55
; here:
56
;beaker.cache.data_dir = %(here)s/data/cache
57
;beaker.session.data_dir = %(here)s/data/sessions
58

  
59
; DB - sqlite fails, not postgresql ready, use mysql for now
60
sqlalchemy.url=postgres://vigilo:vigilo@localhost/vigilo
61

  
62
; echo shouldn't be used together with the logging module.
63
sqlalchemy.echo = false
64
sqlalchemy.echo_pool = false
65
sqlalchemy.pool_recycle = 3600
66

  
67
base_url_filter.base_url=
68
; if you are using Mako and want to be able to reload
69
; the mako template from disk during the development phase
70
; you should say 'true' here
71
; This option is only used for mako templating engine
72
; WARNING: if you want to deploy your application using a zipped egg
73
; (ie: if your application's setup.py defines zip-safe=True, then you
74
; MUST put "false" for the production environment because there will
75
; be no disk and real files to compare time with.
76
; On the contrary if your application defines zip-safe=False and is
77
; deployed in an unzipped manner, then you can leave this option to true
78
templating.mako.reloadfromdisk = true
79

  
80
; the compiled template dir is a directory that must be readable by your
81
; webserver. It will be used to store the resulting templates once compiled
82
; by the TemplateLookup system.
83
; During development you generally don't need this option since paste's HTTP
84
; server will have access to you development directories, but in production
85
; you'll most certainly want to have apache or nginx to write in a directory
86
; that does not contain any source code in any form for obvious security reasons.
87
;
88
;templating.mako.compiled_templates_dir = /some/dir/where/webserver/has/access
89

  
90
; WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT*
91
; Debug mode will enable the interactive debugging tool, allowing ANYONE to
92
; execute malicious code after an exception is raised.
93
set debug = false
94

  
95
; Logging configuration
96
; Add additional loggers, handlers, formatters here
97
; Uses python's logging config file format
98
; http://docs.python.org/lib/logging-config-fileformat.html
99

  
100
[loggers]
101
keys = root, vigiboard, sqlalchemy, auth
102

  
103
[handlers]
104
keys = console,sql_log,root_log,vigiboard_log,auth_log
105

  
106
[formatters]
107
keys = generic
108

  
109
; If you create additional loggers, add them as a key to [loggers]
110
[logger_root]
111
level = DEBUG
112
handlers = root_log
113

  
114
[logger_vigiboard]
115
level = DEBUG
116
handlers = vigiboard_log
117
qualname = vigiboard
118

  
119
[logger_sqlalchemy]
120
level = DEBUG
121
handlers = sql_log
122
qualname = sqlalchemy.engine
123

  
124
; A logger for authentication, identification and authorization -- this is
125
; repoze.who and repoze.what:
126
[logger_auth]
127
level = DEBUG
128
handlers = auth_log
129
qualname = auth
130

  
131
; If you create additional handlers, add them as a key to [handlers]
132
[handler_console]
133
class = StreamHandler
134
args = (sys.stderr,)
135
level = NOTSET
136
formatter = generic
137

  
138
[handler_sql_log]
139
class = FileHandler
140
args = ('log/sql.log','a')
141
level = DEBUG
142
formatter = generic
143

  
144
[handler_root_log]
145
class = FileHandler
146
args = ('log/root.log','a')
147
level = DEBUG
148
formatter = generic
149

  
150
[handler_vigiboard_log]
151
class = FileHandler
152
args = ('log/vigiboard.log','a')
153
level = DEBUG
154
formatter = generic
155

  
156
[handler_auth_log]
157
class = FileHandler
158
args = ('log/auth.log','a')
159
level = DEBUG
160
formatter = generic
161

  
162
; If you create additional formatters, add them as a key to [formatters]
163
[formatter_generic]
164
format = %(asctime)s,%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
165
datefmt = %H:%M:%S
166

  
deployment/vigiboard.conf
1
<IfModule mod_wsgi.c>
2

  
3
WSGIRestrictStdout off
4
WSGIPassAuthorization on
5
WSGIScriptAlias /vigiboard "/etc/vigilo/vigiboard/vigiboard.wsgi"
6

  
7
KeepAlive Off
8

  
9
<Directory "/etc/vigilo/vigiboard/">
10
    <Files "vigiboard.wsgi">
11
        Order deny,allow
12
        Allow from all
13
    </Files>
14
</Directory>
15

  
16
</IfModule>
17

  
deployment/vigiboard.wsgi
1
# -*- coding: utf-8 -*-
2
# vim: set fileencoding=utf-8 sw=4 ts=4 et ft=python :
3

  
4
#import os, sys
5
#from pkg_resources import get_distribution
6

  
7
#egg_file = get_distribution('vigiboard').egg_info
8

  
9
#os.environ['PYTHON_EGG_CACHE'] = '/tmp/vigiboard/python-eggs'
10

  
11
#from paste.script.util.logging_config import fileConfig
12
#fileConfig(basedir + ini_file)
13

  
14
import os.path
15
ini_file = '/etc/vigilo/vigiboard/settings.ini'
16
ini_file = os.path.join('/', *ini_file.split('/'))
17

  
18
from paste.deploy import loadapp
19
application = loadapp('config:%s' % ini_file)
20

  
development.ini
22 22
[app:main]
23 23
use = egg:vigiboard
24 24

  
25
db_basename=
26
password_hashing_function=md5
27
lang=fr
28
use_kerberos=False
29

  
25 30
; Nombre d'événements par page.
26 31
vigiboard_items_per_page = 15
27 32

  
......
42 47

  
43 48

  
44 49
full_stack = true
45
#lang = fr
46 50
cache_dir = %(here)s/data
47 51
beaker.session.key = vigiboard
48 52
beaker.session.secret = somesecret
......
54 58
#beaker.session.data_dir = %(here)s/data/sessions
55 59

  
56 60
# DB - sqlite fails, not postgresql ready, use mysql for now
57
#sqlalchemy.url = sqlite:///%(here)s/devdata.db
58
#sqlalchemy.url=mysql://vigiboard:penmdor@localhost/vigiboard
59
#sqlalchemy.url=postgres://vigiboard:tandreja@localhost/vigiboard
60
#sqlalchemy.url=mysql://root:tandreja@localhost:3306/vigiboard
61
sqlalchemy.url=postgres://vigilo:vigilo@localhost/vigilo
61 62
#echo shouldn't be used together with the logging module.
62 63
sqlalchemy.echo = false
63 64
sqlalchemy.echo_pool = false
production.ini
1
#
2
# vigiboard - Pylons development environment configuration
3
#
4
# The %(here)s variable will be replaced with the parent directory of this file
5
#
6
# This file is for deployment specific config options -- other configuration
7
# that is always required for the app is done in the config directory, 
8
# and generally should not be modified by end users. 
9

  
10
[DEFAULT]
11
debug = false
12
# Uncomment and replace with the address which should receive any error reports
13
#email_to = you@yourdomain.com
14
smtp_server = localhost
15
error_email_from = paste@localhost
16

  
17
[server:main]
18
use = egg:Paste#http
19
host = 127.0.0.1 
20
port = 8080
21

  
22
[app:main]
23
use = egg:vigiboard
24

  
25
# Requis par Vigiboard
26
appname = vigiboard
27

  
28
; Ordre de tri pour la priorité des événements.
29
; - Utiliser "asc" si la priorité est inversement proportionnelle à sa
30
;   valeur (ie: plus le nombre est bas, plus la priorité est élevée).
31
; - Utiliser "desc" si la priorité est proportionnelle à sa valeur
32
;   (ie: plus le nombre est élevé, plus la priorité est basse).
33
; NE PAS METTRE DE GUILLEMETS/APOSTROPHES AUTOUR DE LA VALEUR.
34
vigiboard_priority_order = asc
35

  
36
full_stack = true
37
#lang = fr
38
cache_dir = %(here)s/data
39
beaker.session.key = vigiboard
40
beaker.session.secret = somesecret
41

  
42
# If you'd like to fine-tune the individual locations of the cache data dirs
43
# for the Cache data, or the Session saves, un-comment the desired settings
44
# here:
45
#beaker.cache.data_dir = %(here)s/data/cache
46
#beaker.session.data_dir = %(here)s/data/sessions
47

  
48
# DB - sqlite fails, not postgresql ready, use mysql for now
49
#sqlalchemy.url = sqlite:///%(here)s/devdata.db
50
#sqlalchemy.url=mysql://vigiboard:penmdor@localhost/vigiboard
51
sqlalchemy.url=postgres://vigiboard:tandreja@localhost/vigiboard
52
#sqlalchemy.url=mysql://root:tandreja@localhost:3306/vigiboard
53
#echo shouldn't be used together with the logging module.
54
sqlalchemy.echo = false
55
sqlalchemy.echo_pool = false
56
sqlalchemy.pool_recycle = 3600
57

  
58
base_url_filter.base_url=
59
# if you are using Mako and want to be able to reload
60
# the mako template from disk during the development phase
61
# you should say 'true' here
62
# This option is only used for mako templating engine
63
# WARNING: if you want to deploy your application using a zipped egg
64
# (ie: if your application's setup.py defines zip-safe=True, then you
65
# MUST put "false" for the production environment because there will
66
# be no disk and real files to compare time with.
67
# On the contrary if your application defines zip-safe=False and is
68
# deployed in an unzipped manner, then you can leave this option to true
69
templating.mako.reloadfromdisk = true
70

  
71
# the compiled template dir is a directory that must be readable by your
72
# webserver. It will be used to store the resulting templates once compiled
73
# by the TemplateLookup system.
74
# During development you generally don't need this option since paste's HTTP
75
# server will have access to you development directories, but in production
76
# you'll most certainly want to have apache or nginx to write in a directory
77
# that does not contain any source code in any form for obvious security reasons.
78
#
79
#templating.mako.compiled_templates_dir = /some/dir/where/webserver/has/access
80

  
81
# WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT*
82
# Debug mode will enable the interactive debugging tool, allowing ANYONE to
83
# execute malicious code after an exception is raised.
84
set debug = false
85

  
86
# Logging configuration
87
# Add additional loggers, handlers, formatters here
88
# Uses python's logging config file format
89
# http://docs.python.org/lib/logging-config-fileformat.html
90

  
91
[loggers]
92
keys = root, vigiboard, sqlalchemy, auth
93

  
94
[handlers]
95
keys = console,sql_log,root_log,vigiboard_log,auth_log
96

  
97
[formatters]
98
keys = generic
99

  
100
# If you create additional loggers, add them as a key to [loggers]
101
[logger_root]
102
level = DEBUG
103
handlers = root_log
104

  
105
[logger_vigiboard]
106
level = DEBUG
107
handlers = vigiboard_log
108
qualname = vigiboard
109

  
110
[logger_sqlalchemy]
111
level = DEBUG
112
handlers = sql_log
113
qualname = sqlalchemy.engine
114

  
115
# A logger for authentication, identification and authorization -- this is
116
# repoze.who and repoze.what:
117
[logger_auth]
118
level = DEBUG
119
handlers = auth_log
120
qualname = auth
121

  
122
# If you create additional handlers, add them as a key to [handlers]
123
[handler_console]
124
class = StreamHandler
125
args = (sys.stderr,)
126
level = NOTSET
127
formatter = generic
128

  
129
[handler_sql_log]
130
class = FileHandler
131
args = ('log/sql.log','a')
132
level = DEBUG
133
formatter = generic
134

  
135
[handler_root_log]
136
class = FileHandler
137
args = ('log/root.log','a')
138
level = DEBUG
139
formatter = generic
140

  
141
[handler_vigiboard_log]
142
class = FileHandler
143
args = ('log/vigiboard.log','a')
144
level = DEBUG
145
formatter = generic
146

  
147
[handler_auth_log]
148
class = FileHandler
149
args = ('log/auth.log','a')
150
level = DEBUG
151
formatter = generic
152

  
153
# If you create additional formatters, add them as a key to [formatters]
154
[formatter_generic]
155
format = %(asctime)s,%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
156
datefmt = %H:%M:%S
settings.py
1
../glue/settings.py
settings_tests.py
1
# vim: set fileencoding=utf-8 sw=4 ts=4 et :
2

  
3
VIGILO_MODELS_BDD_BASENAME = ''
4
VIGILO_SQLALCHEMY = {
5
    'url': 'sqlite:///:memory:',
6
}
7

  
8
USE_KERBEROS = False
9

  
10
VIGILO_ALL_DEFAULT_LANGUAGE = 'fr'
11

  
setup.cfg
37 37
input_file = vigiboard/i18n/vigiboard.pot
38 38
output_dir = vigiboard/i18n
39 39
previous = true
40

  
41
[bdist_rpm]
42
install_script = rpm_install
43
provides = vigiboard
44
requires = vigilo-turbogears
45

  
setup.py
1
#!/usr/bin/env python
1 2
# -*- coding: utf-8 -*-
2 3
# vim:set expandtab tabstop=4 shiftwidth=4:
3 4
try:
......
17 18
    name='vigiboard',
18 19
    version='0.1',
19 20
    description='IHM Module for the Dashboard',
20
    author="""Thomas ANDREJAK""",
21
    author_email="""thomas.andrejak@gmail.com""",
21
    author="Thomas ANDREJAK",
22
    author_email="thomas.andrejak@gmail.com",
22 23
    zip_safe=False,
24
    license='http://www.gnu.org/licenses/gpl-2.0.html',
23 25
    install_requires=[
24
        "tg.devtools",
25
        "TurboGears2 >= 2.0b7",
26
        "Catwalk >= 2.0.2",
27
        "Babel >=0.9.4",
28
        "ToscaWidgets >= 0.9.7.1",
29
        "zope.sqlalchemy >= 0.4 ",
30
        "repoze.tm2 >= 1.0a4",
31
        "repoze.what-quickstart >= 1.0",
32
        "psycopg2",
33
        "tw.jquery >= 0.9.5",
34
        "vigilo-models",
35
        "vigilo-themes-default",
36
        "PasteScript >= 1.7", # setup_requires has issues
37
        "PasteDeploy",
38
        "Paste",
39
        "decorator != 3.1.0", # Blacklist bad version
40 26
        "vigilo-turbogears",
41
        #"modwsgideploy",
27
        "tw.forms",
42 28
    ],
43 29

  
44 30
    paster_plugins=['PasteScript', 'Pylons', 'TurboGears2', 'tg.devtools'],
......
49 35
    extras_require={
50 36
        'tests': tests_require,
51 37
    },
52
    package_data={'vigiboard': [
38
    package_data={
39
        'vigiboard': [
53 40
            'i18n/*/LC_MESSAGES/*.mo',
54
    ]},
41
        ],
42
    },
55 43
    message_extractors={'vigiboard': [
56 44
            ('**.py', 'python', None),
57 45
    ]},
......
63 51
        'paste.app_install': [
64 52
            'main = pylons.util:PylonsInstaller',
65 53
        ],
54
        'console_scripts': [
55
            'vigiboard-init-db = vigiboard.websetup:init_db',
56
        ],
66 57
    },
58
    data_files=[
59
        ('/etc/vigilo/vigiboard/', [
60
            'deployment/vigiboard.conf',
61
            'deployment/vigiboard.wsgi',
62
            'deployment/settings.ini',
63
        ]),
64
    ],
67 65
)
68 66

  
test.ini
18 18
[app:main]
19 19
#sqlalchemy.url=postgres://vigiboard:tandreja@localhost/vigiboard_test
20 20
#sqlalchemy.url=mysql://root:tandreja@localhost:3306/vigiboard_test
21
#sqlalchemy.url = sqlite:///:memory:
21
sqlalchemy.url = sqlite:///:memory:
22
;sqlalchemy.url = sqlite:////tmp/vigiboard_tests.sqlite
23
db_basename =
24
use_kerberos = False
22 25
use = config:development.ini
23 26

  
24 27
[app:main_without_authn]
vigiboard/config/app_cfg.py
15 15
"""
16 16

  
17 17
from vigilo import models
18
from vigilo.models.session import DBSession
19
from vigilo.models.vigilo_bdd_config import metadata
20
metadata.bind = DBSession.bind
21 18

  
22 19
from vigilo.turbogears import VigiloAppConfig
23 20
from pylons.i18n import lazy_ugettext as l_
......
27 24

  
28 25

  
29 26
base_config = VigiloAppConfig('vigiboard')
27

  
30 28
base_config.renderers = []
31 29

  
32 30
base_config.package = vigiboard
......
34 32
#Set the default renderer
35 33
base_config.default_renderer = 'genshi'
36 34
base_config.renderers.append('genshi')
37
# if you want raw speed and have installed chameleon.genshi
38
# you should try to use this renderer instead.
39
# warning: for the moment chameleon does not handle i18n translations
40
#base_config.renderers.append('chameleon_genshi')
41 35

  
42 36
#Configure the base SQLALchemy Setup
43 37
base_config.use_sqlalchemy = True
44 38
base_config.model = models
45
base_config.DBSession = DBSession
39

  
40
#from vigilo.models import configure
41

  
42
#base_config.DBSession = configure.DBSession
46 43

  
47 44
# Configure the authentication backend
48 45
base_config.auth_backend = 'sqlalchemy'
49
base_config.sa_auth.dbsession = DBSession
46
#base_config.sa_auth.dbsession = configure.DBSession
50 47
# what is the class you want to use to search for users in the database
51 48
base_config.sa_auth.user_class = models.User
52 49
# what is the class you want to use to search for groups in the database
vigiboard/controllers/root.py
18 18
from sqlalchemy.sql import func
19 19
from repoze.what.predicates import Any, not_anonymous
20 20

  
21
from vigilo.models.session import DBSession
21
from vigilo.models.configure import DBSession
22 22
from vigilo.models import Event, EventHistory, CorrEvent, SupItem, \
23 23
                            HostGroup, ServiceGroup, StateName, User
24 24
from vigilo.models.functions import sql_escape_like
vigiboard/controllers/vigiboard_plugin/shn.py
8 8
from tg import url
9 9

  
10 10
from vigiboard.controllers.vigiboard_plugin import VigiboardRequestPlugin
11
from vigilo.models.session import DBSession
11
from vigilo.models.configure import DBSession
12 12
from vigilo.models import HighLevelService, \
13 13
                            CorrEvent, Event, SupItem
14 14

  
vigiboard/controllers/vigiboardrequest.py
11 11
from sqlalchemy import not_, and_, asc, desc
12 12
from sqlalchemy.sql.expression import or_, null as expr_null, union
13 13

  
14
from vigilo.models.session import DBSession
14
from vigilo.models.configure import DBSession
15 15
from vigilo.models import Event, CorrEvent, EventHistory, \
16 16
                        Host, LowLevelService, StateName
17 17
from vigilo.models.secondary_tables import HOST_GROUP_TABLE, \
......
19 19
from vigiboard.widgets.edit_event import EditEventForm
20 20
from vigiboard.widgets.search_form import SearchForm
21 21
from vigiboard.controllers.vigiboard_plugin import VigiboardRequestPlugin
22
from vigilo.common.conf import settings
23 22

  
24 23
LOGGER = getLogger(__name__)
25 24

  
......
48 47
        # On récupère la langue du navigateur de l'utilisateur
49 48
        lang = get_lang()
50 49
        if not lang:
51
            lang = settings['VIGILO_ALL_DEFAULT_LANGUAGE']
50
            lang = config['lang']
52 51
        else:
53 52
            lang = lang[0]
54 53

  
vigiboard/tests/__init__.py
12 12
import nose
13 13
from nose.tools import eq_, nottest
14 14

  
15
from vigilo.models.vigilo_bdd_config import metadata
16
from vigilo.models.session import DBSession
15
from vigilo.models.configure import metadata, DBSession
17 16

  
18 17
__all__ = ['setup_db', 'teardown_db', 'TestController', 'url_for']
19 18

  
20
metadata.bind = DBSession.bind
21

  
22 19
def setup_db():
23 20
    """Method used to build a database"""
24
    metadata.create_all()
21
    print "Creating model"
22
    engine = config['pylons.app_globals'].sa_engine
23
    metadata.create_all(engine)
25 24

  
26 25
def teardown_db():
27 26
    """Method used to destroy a database"""
28
    metadata.drop_all()
29

  
27
    print "Destroying model"
28
    engine = config['pylons.app_globals'].sa_engine
29
    metadata.drop_all(engine)
30 30

  
31 31
class TestController(object):
32 32
    """
......
53 53
    def setUp(self):
54 54
        """Method called by nose before running each test"""
55 55
        # Loading the application:
56
        setup_db()
56 57
        conf_dir = config.here
57
        wsgiapp = loadapp('config:test.ini#%s' % self.application_under_test,
58
                          relative_to=conf_dir)
58
        wsgiapp = loadapp('config:test.ini#%s' %
59
            self.application_under_test, relative_to=conf_dir)
59 60
        self.app = TestApp(wsgiapp)
60 61
        # Setting it up:
61 62
        test_file = path.join(conf_dir, 'test.ini')
vigiboard/tests/functional/test_event_table.py
8 8
from datetime import datetime
9 9
import transaction
10 10

  
11
from vigilo.models.session import DBSession
11
from vigilo.models.configure import DBSession
12 12
from vigilo.models import Event, CorrEvent, \
13 13
                            Permission, StateName, \
14 14
                            Host, HostGroup, LowLevelService
vigiboard/tests/functional/test_history_form.py
8 8
import transaction
9 9

  
10 10
from vigiboard.tests import TestController
11
from vigilo.models.session import DBSession
11
from vigilo.models.configure import DBSession
12 12
from vigilo.models import ServiceGroup, HostGroup, \
13 13
                            Host, Permission, StateName, \
14 14
                            LowLevelService, Event, CorrEvent
vigiboard/tests/functional/test_history_tables.py
8 8
from datetime import datetime
9 9
import transaction
10 10

  
11
from vigilo.models.session import DBSession
11
from vigilo.models.configure import DBSession
12 12
from vigilo.models import Event, EventHistory, CorrEvent, \
13 13
                            Permission, StateName, \
14 14
                            Host, HostGroup, LowLevelService, ServiceGroup
......
319 319
        rows = response.lxml.xpath('//table[@class="history_table"]/tbody/tr')
320 320
        assert_equal(len(rows), 4)
321 321

  
322

  
323

  
vigiboard/tests/functional/test_host_vigiboardrequest.py
9 9
import tg
10 10
import transaction
11 11

  
12
from vigilo.models.session import DBSession
12
from vigilo.models.configure import DBSession
13 13
from vigilo.models import Event, EventHistory, CorrEvent, \
14 14
                            Permission, User, StateName, \
15 15
                            Host, HostGroup
......
109 109

  
110 110
    def tearDown(self):
111 111
        """ Nettoyage de la base de données après les tests. """
112
        TestController.tearDown(self)
112
        super(TestHostVigiboardRequest, self).tearDown()
113 113

  
114 114

  
115 115
    def test_request_creation(self):
vigiboard/tests/functional/test_search_form_host.py
7 7
import transaction
8 8

  
9 9
from vigiboard.tests import TestController
10
from vigilo.models.session import DBSession
10
from vigilo.models.configure import DBSession
11 11
from vigilo.models import HostGroup, Host, Permission, \
12 12
                        Event, CorrEvent, StateName
13 13

  
vigiboard/tests/functional/test_search_form_hostgroup.py
7 7
import transaction
8 8

  
9 9
from vigiboard.tests import TestController
10
from vigilo.models.session import DBSession
10
from vigilo.models.configure import DBSession
11 11
from vigilo.models import HostGroup, Host, Permission, \
12 12
                        Event, CorrEvent, StateName
13 13

  
vigiboard/tests/functional/test_search_form_misc.py
7 7
import transaction
8 8

  
9 9
from vigiboard.tests import TestController
10
from vigilo.models.session import DBSession
10
from vigilo.models.configure import DBSession
11 11
from vigilo.models import HostGroup, Host, Permission, \
12 12
                            Event, CorrEvent, StateName
13 13

  
vigiboard/tests/functional/test_search_form_service.py
7 7
import transaction
8 8

  
9 9
from vigiboard.tests import TestController
10
from vigilo.models.session import DBSession
10
from vigilo.models.configure import DBSession
11 11
from vigilo.models import ServiceGroup, HostGroup, \
12 12
                            Host, Permission, StateName, \
13 13
                            LowLevelService, Event, CorrEvent
vigiboard/tests/functional/test_search_form_servicegroup.py
7 7
import transaction
8 8

  
9 9
from vigiboard.tests import TestController
10
from vigilo.models.session import DBSession
10
from vigilo.models.configure import DBSession
11 11
from vigilo.models import ServiceGroup, Host, Permission, Event, \
12 12
                        LowLevelService, CorrEvent, StateName
13 13

  
vigiboard/tests/functional/test_userutils.py
6 6
import transaction
7 7
from nose.tools import assert_true
8 8

  
9
from vigilo.models.session import DBSession
9
from vigilo.models.configure import DBSession
10 10
from vigilo.models import HostGroup, Permission, User
11 11
from vigiboard.tests import TestController
12 12

  
vigiboard/tests/functional/test_vigiboardrequest.py
9 9
import tg
10 10
import transaction
11 11

  
12
from vigilo.models.session import DBSession
12
from vigilo.models.configure import DBSession
13 13
from vigilo.models import Event, EventHistory, CorrEvent, \
14 14
                            Permission, User, StateName, \
15 15
                            Host, HostGroup, LowLevelService, ServiceGroup
vigiboard/tests/functional/vigiboard_plugin/test_plugin_hls.py
8 8
from vigilo.models import Permission, StateName, \
9 9
                            HostGroup, Host, HighLevelService, \
10 10
                            Event, CorrEvent, ImpactedPath, ImpactedHLS
11
from vigilo.models.session import DBSession
12

  
11
from vigilo.models.configure import DBSession
13 12

  
14 13
def populate_DB():
15 14
    """ Peuple la base de données. """
......
150 149
            {"idcorrevent" : str(aggregate.idcorrevent),
151 150
             "plugin_name" : "shn"},
152 151
            status = 404,
153
            extra_environ={'REMOTE_USER': 'editor'},)
152
            extra_environ={'REMOTE_USER': 'editor'})
154 153
        
155 154
        ### 3ème cas : l'utilisateur a cette fois les droits.        
156 155
        resp = self.app.post(
vigiboard/websetup.py
16 16
    load_environment(conf.global_conf, conf.local_conf)
17 17
    populate_db()
18 18

  
19
def init_db():
20
    """
21
    Cette fonction est appelée par le script vigiboard-init-db
22
    pour initialiser la base de données de VigiBoard.
23
    """
24
    from paste.script.appinstall import SetupCommand
25
    import os.path
26

  
27
    ini_file = '/etc/vigilo/vigiboard/settings.ini'
28
    ini_file = os.path.join('/', *ini_file.split('/'))
29

  
30
    cmd = SetupCommand('setup-app')
31
    cmd.run([ini_file])
32

  

Also available in: Unified diff