~powersj/jenkins-launchpad-plugin/skip-message-check

« back to all changes in this revision

Viewing changes to jlp/commands/voteOnMergeProposal.py

  • Committer: Tarmac
  • Author(s): Parameswaran Sivatharman
  • Date: 2015-09-25 08:31:14 UTC
  • mfrom: (124.2.6 stop-tmp-leak)
  • Revision ID: tarmac-20150925083114-h9cp5dgwmljheuft
Fix to wrap the launchpadlib leaking launchpadlib_cache directory.

Approved by Francis Ginther, PS Jenkins bot, Joe Talbott.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
from argparse import ArgumentParser
 
2
import atexit
2
3
from jlp import launchpadutils, get_launchpad, logger
3
4
import re
4
5
import os
24
25
    launchpad_cachedir = os.path.join('/tmp',
25
26
                                      str(os.getpid()),
26
27
                                      '.launchpadlib')
 
28
 
 
29
    # `launchpad_cachedir` is leaked upon unexpected exits
 
30
    # adding this cleanup to stop directories filling up `/tmp/`
 
31
    atexit.register(rmtree, os.path.join('/tmp',
 
32
                                         str(os.getpid())),
 
33
                    ignore_errors=True)
27
34
    lp_handle = get_launchpad(launchpadlib_dir=launchpad_cachedir)
28
35
    mp = launchpadutils.get_mp_handle_from_url(lp_handle,
29
36
                                               args['merge_proposal'])
61
68
                                     args['build_url'],
62
69
                                     reason)
63
70
 
64
 
    rmtree(launchpad_cachedir, ignore_errors=True)
65
71
    return 0