~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to database/schema/full-update.py

  • Committer: Stuart Bishop
  • Date: 2011-07-26 08:37:52 UTC
  • mto: (7675.1045.660 db-devel)
  • mto: This revision was merged to the branch mainline in revision 13516.
  • Revision ID: stuart.bishop@canonical.com-20110726083752-g69xinu8mer8o3yi
Review feedback

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
PGBOUNCER_INITD = ['sudo', '/etc/init.d/pgbouncer']
29
29
 
30
30
 
31
 
def run_script(script, *extra_args):
32
 
    script_path = os.path.join(os.path.dirname(__file__), script)
33
 
    return subprocess.call([script_path] + sys.argv[1:] + list(extra_args))
34
 
 
35
 
 
36
31
def run_pgbouncer(log, cmd):
37
32
    """Invoke the pgbouncer initscript.
38
33
 
39
34
    :param cmd: One of 'start', 'stop' or 'status'.
40
35
    """
41
 
    assert cmd in ('start', 'stop', 'status'), (
42
 
        'sudo access needs to be granted to new commands on staging and prod'
43
 
        )
 
36
    assert cmd in ('start', 'stop', 'status'), '''
 
37
        Unrecognized command; remember any new commands need to be
 
38
        granted sudo on staging and prod.
 
39
        '''
44
40
    pgbouncer_rc = subprocess.call(PGBOUNCER_INITD + [cmd])
45
41
    sys.stdout.flush()
46
42
    if pgbouncer_rc != 0:
127
123
    # status flags
128
124
    pgbouncer_down = False
129
125
    upgrade_run = False
130
 
    # Bug #815717
131
 
    # fti_run = False
132
126
    security_run = False
133
127
 
134
128
    try:
147
141
            return upgrade_rc
148
142
        upgrade_run = True
149
143
 
150
 
        # fti.py is no longer being run on production. Updates
151
 
        # to full text indexes need to be handled manually in db
152
 
        # patches. Bug #815717.
153
 
        # fti_rc = run_script('fti.py')
154
 
        # if fti_rc != 0:
155
 
        #     return fti_rc
156
 
        # fti_run = True
157
 
 
158
144
        security_rc = run_security(options, log)
159
145
        if security_rc != 0:
160
146
            return security_rc
198
184
                log.fatal("pgbouncer is down and refuses to restart")
199
185
        if not upgrade_run:
200
186
            log.warning("upgrade.py still needs to be run")
201
 
        # Bug #815717
202
 
        # if not fti_run:
203
 
        #     log.warning("fti.py still needs to be run")
204
187
        if not security_run:
205
188
            log.warning("security.py still needs to be run")
206
189