blob: 762e982e301d66bfb45a1ac6e1ce057ea09f3754 [file] [log] [blame]
David Paterson4af1d022015-04-02 01:27:34 -04001# Copyright 2015 Dell Inc.
2# Licensed under the Apache License, Version 2.0 (the "License"); you may
3# not use this file except in compliance with the License. You may obtain
4# a copy of the License at
5#
6# http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
11# License for the specific language governing permissions and limitations
12# under the License.
13
14import logging
15import sys
16
17from cliff import app
18from cliff import commandmanager
19
20TEMPEST_CLI_VERSION = '0.1'
21
22
23class Main(app.App):
24
25 log = logging.getLogger(__name__)
26
27 def __init__(self):
28 super(Main, self).__init__(
29 description='Tempest cli application',
30 version=TEMPEST_CLI_VERSION,
31 command_manager=commandmanager.CommandManager('tempest.cm'),
32 )
33
34 def initialize_app(self, argv):
35 self.log.debug('tempest initialize_app')
36
37 def prepare_to_run_command(self, cmd):
38 self.log.debug('prepare_to_run_command %s', cmd.__class__.__name__)
39
40 def clean_up(self, cmd, result, err):
41 self.log.debug('tempest clean_up %s', cmd.__class__.__name__)
42 if err:
43 self.log.debug('tempest got an error: %s', err)
44
45
46def main(argv=sys.argv[1:]):
47 the_app = Main()
48 return the_app.run(argv)
49
50
51if __name__ == '__main__':
52 sys.exit(main(sys.argv[1:]))