~ubuntu-branches/debian/squeeze/specto/squeeze

« back to all changes in this revision

Viewing changes to debian/patches/03_dont_crash_on_corrupt_config.dpatch

  • Committer: Bazaar Package Importer
  • Author(s): Christopher James Halse Rogers (RAOF)
  • Date: 2007-03-19 22:16:33 UTC
  • Revision ID: james.westby@ubuntu.com-20070319221633-d0jkg081xk8gdbh3
Tags: 0.2.0-0ubuntu2
debian/patches/03_dont_crash_on_corrupt_config
Closes LP# 93179

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh /usr/share/dpatch/dpatch-run
 
2
## 03_dont_crash_on_corrupt_config.dpatch by  <chris@Burninator>
 
3
##
 
4
## All lines beginning with `## DP:' are a description of the patch.
 
5
## DP: No description.
 
6
 
 
7
@DPATCH@
 
8
diff -urNad specto-0.2.0~/spectlib/watch.py specto-0.2.0/spectlib/watch.py
 
9
--- specto-0.2.0~/spectlib/watch.py     2007-02-08 17:46:19.000000000 +1100
 
10
+++ specto-0.2.0/spectlib/watch.py      2007-03-19 22:15:59.000000000 +1100
 
11
@@ -184,27 +184,53 @@
 
12
                 watch_options.update(watch_options_)
 
13
             values = {}
 
14
             values['name'] = name_
 
15
-            values['type'] = int(watch_options['type'])
 
16
+            try :
 
17
+               values['type'] = int(watch_options['type'])
 
18
+            except KeyError :
 
19
+               ### XXX: Hack!  If any of this info is incomplete, just move 
 
20
+               ### on to the next config item rather than crashing!
 
21
+               continue
 
22
             del watch_options['type'] #delete the standard options from the dictionary with extra arguments because we allready saved them in the line above
 
23
-            values['refresh'] = int(watch_options['refresh'])
 
24
+            try :
 
25
+               values['refresh'] = int(watch_options['refresh'])
 
26
+            except KeyError :
 
27
+               ### XXX: Hack, as above
 
28
+               continue
 
29
             del watch_options['refresh']
 
30
 
 
31
             if int(values['type']) == 0:
 
32
-                values['uri'] = watch_options['uri']
 
33
-                values['error_margin'] = watch_options['error_margin']
 
34
+               try : 
 
35
+                  values['uri'] = watch_options['uri']
 
36
+                  values['error_margin'] = watch_options['error_margin']
 
37
+               except KeyError :
 
38
+                  ### XXX: Hack as above
 
39
+                  continue
 
40
 
 
41
             elif int(values['type']) == 1:
 
42
-                values['prot'] = watch_options['prot']
 
43
-                if int(values['prot']) != 2:
 
44
-                    values['host'] = watch_options['host']
 
45
-                    values['ssl'] = watch_options['ssl']
 
46
-                values['username'] = watch_options['username']
 
47
-                values['password'] = watch_options['password']
 
48
+               try :
 
49
+                  values['prot'] = watch_options['prot']
 
50
+                  if int(values['prot']) != 2:
 
51
+                     values['host'] = watch_options['host']
 
52
+                     values['ssl'] = watch_options['ssl']
 
53
+                  values['username'] = watch_options['username']
 
54
+                  values['password'] = watch_options['password']
 
55
+               except KeyError :
 
56
+                  ### XXX: Hack, as above
 
57
+                  continue
 
58
             elif int(values['type']) == 2:
 
59
-                values['file'] = watch_options['file']
 
60
-                values['mode'] = watch_options['mode']
 
61
+               try :
 
62
+                  values['file'] = watch_options['file']
 
63
+                  values['mode'] = watch_options['mode']
 
64
+               except KeyError :
 
65
+                  ### XXX: Hack, as above
 
66
+                  continue
 
67
+                  
 
68
             elif int(values['type']) == 3:
 
69
-                values['process'] = watch_options['process']
 
70
+               try :
 
71
+                  values['process'] = watch_options['process']
 
72
+               except KeyError :
 
73
+                  ###XXX: Hack, as above
 
74
+                  continue
 
75
                 
 
76
             try:
 
77
                 if watch_options['updated'] == "True":