~hudson-openstack/burrow/trunk

« back to all changes in this revision

Viewing changes to burrow/shell.py

  • Committer: Tarmac
  • Author(s): Eric Day
  • Date: 2011-08-24 20:23:03 UTC
  • mfrom: (33.1.7 doc-updates)
  • Revision ID: tarmac-20110824202303-fc09r0aendi1tn6m
Added client API unit tests, moved exceptions to main burrow module, and added more WSGI frontend tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
112
112
        '''Run the command given in arguments or enter an interactive shell.'''
113
113
        if len(self.args) == 0:
114
114
            for command in self._get_command():
115
 
                self.run_command(command[0], command[1:])
 
115
                try:
 
116
                    self.run_command(command[0], command[1:])
 
117
                except burrow.NotFound, exception:
 
118
                    print exception
116
119
        else:
117
120
            self.run_command(self.args[0], self.args[1:])
118
121
 
131
134
        while True:
132
135
            try:
133
136
                command = raw_input(prompt)
 
137
            except KeyboardInterrupt:
 
138
                break
134
139
            except EOFError:
135
140
                if os.isatty(sys.stdin.fileno()):
136
141
                    print
164
169
            args.append(self._pack_attributes())
165
170
        if section.get('filters', None):
166
171
            args.append(self._pack_filters())
167
 
        try:
168
 
            result = getattr(self.client, command)(*args)
169
 
        except Exception, exception:
170
 
            print exception
171
 
            return
 
172
        result = getattr(self.client, command)(*args)
172
173
        self._print_result(result)
173
174
 
174
175
    def _get_section(self, command):