~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to database/schema/preflight.py

  • Committer: Curtis Hovey
  • Date: 2011-12-29 05:29:36 UTC
  • mto: This revision was merged to the branch mainline in revision 14606.
  • Revision ID: curtis.hovey@canonical.com-20111229052936-c261pibg1p6ze6m4
Moved canonical.config to lp.services.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/python2.6 -S
2
 
# Copyright 2011-2012 Canonical Ltd.  This software is licensed under the
 
2
# Copyright 2011 Canonical Ltd.  This software is licensed under the
3
3
# GNU Affero General Public License version 3 (see the file LICENSE).
4
4
 
5
5
"""Confirm the database systems are ready to be patched as best we can."""
6
6
 
 
7
import _pythonpath
 
8
 
7
9
__all__ = [
8
10
    'DatabasePreflight',
9
11
    'KillConnectionsPreflight',
10
12
    'NoConnectionCheckPreflight',
11
13
    ]
12
14
 
13
 
import _pythonpath
14
15
 
15
16
from datetime import timedelta
16
17
from optparse import OptionParser
19
20
 
20
21
import psycopg2
21
22
 
22
 
from lp.services.database.sqlbase import (
 
23
from canonical.database.sqlbase import (
23
24
    connect,
24
25
    ISOLATION_LEVEL_AUTOCOMMIT,
25
26
    sqlvalues,
32
33
import replication.helpers
33
34
import upgrade
34
35
 
 
36
 
35
37
# Ignore connections by these users.
36
38
SYSTEM_USERS = frozenset(['postgres', 'slony', 'nagios', 'lagmon'])
37
39
 
56
58
BAD_USERS = frozenset([
57
59
    'karma',  # Bug #863109
58
60
    'rosettaadmin',  # Bug #863122
59
 
    'update-pkg-cache',  # Bug #912144
60
 
    'process_death_row',  # Bug #912146
61
 
    'langpack',  # Bug #912147
62
61
    ])
63
62
 
64
63
# How lagged the cluster can be before failing the preflight check.