150 for appid in args: |
150 for appid in args: |
151 if askconfirm: |
151 if askconfirm: |
152 print '*'*72 |
152 print '*'*72 |
153 if not ASK.confirm('%s instance %r ?' % (self.name, appid)): |
153 if not ASK.confirm('%s instance %r ?' % (self.name, appid)): |
154 continue |
154 continue |
155 status = max(status, self.run_arg(appid)) |
155 try: |
|
156 status = max(status, self.run_arg(appid)) |
|
157 except (KeyboardInterrupt, SystemExit): |
|
158 print >> sys.stderr, '%s aborted' % self.name |
|
159 return 2 # specific error code |
156 sys.exit(status) |
160 sys.exit(status) |
157 |
161 |
158 def run_arg(self, appid): |
162 def run_arg(self, appid): |
159 cmdmeth = getattr(self, '%s_instance' % self.name) |
163 cmdmeth = getattr(self, '%s_instance' % self.name) |
160 try: |
164 try: |
161 status = cmdmeth(appid) |
165 status = cmdmeth(appid) |
162 except (KeyboardInterrupt, SystemExit): |
|
163 print >> sys.stderr, '%s aborted' % self.name |
|
164 return 2 # specific error code |
|
165 except (ExecutionError, ConfigurationError), ex: |
166 except (ExecutionError, ConfigurationError), ex: |
166 print >> sys.stderr, 'instance %s not %s: %s' % ( |
167 print >> sys.stderr, 'instance %s not %s: %s' % ( |
167 appid, self.actionverb, ex) |
168 appid, self.actionverb, ex) |
168 status = 4 |
169 status = 4 |
169 except Exception, ex: |
170 except Exception, ex: |