~inspirated/arsenal/send-attachments-lpltk

« back to all changes in this revision

Viewing changes to contrib/expire-bugs.py

  • Committer: Bryce Harrington
  • Date: 2009-03-02 22:02:25 UTC
  • Revision ID: bryce@canonical.com-20090302220225-opburvfkmj6xu624
Add support for error handling.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/python
2
2
 
3
3
from arsenal_lib import *
 
4
from urllib2 import URLError, HTTPError
 
5
import httplib2
 
6
#httplib2.debuglevel = 1
4
7
 
5
8
if len(sys.argv) < 2:
6
9
    sys.stderr.write("Usage: " + sys.argv[0] + " <source-package> [source-package ...]\n")
7
10
    exit(1)
8
11
 
9
12
opt_dryrun  = 0
10
 
max_age     = 30
 
13
max_age     = 32
11
14
total_count = 0
12
15
source_pkgs = sys.argv[1:]
 
16
new_status  = "Invalid"
13
17
arsenal     = Arsenal()
14
18
d           = arsenal.load_project("ubuntu")
15
 
new_status  = "Invalid"
16
19
 
17
20
message = """
18
21
We're closing this bug since it is has been some time with no response from the original reporter.  However, if the issue still exists please feel free to reopen with the requested information.  Also, if you could, please test against the latest development version of Ubuntu, since this confirms the bug is one we may be able to pass upstream for help.
23
26
total = 0
24
27
for source_pkg in source_pkgs:
25
28
    count = 0
 
29
    
26
30
    for bugtask in d.searchTasks(search_text=source_pkg, status="Incomplete (without response)"):
27
31
        if bugtask.bug_target_display_name != source_pkg + " (Ubuntu)":
28
32
            continue
42
46
                    total = total + 1
43
47
                    print " ---> " + new_status
44
48
 
45
 
            except:
46
 
                print "Error communicating with launchpad"
 
49
            except HTTPError, e:
 
50
                print "*** Encountered HTTP error processing ", pkg, " ***"
 
51
                print e.content
 
52
                time.sleep(4)
47
53
                arsenal     = Arsenal()
48
54
                d           = arsenal.load_project("ubuntu")
49
55