blob: 1090c41b10a336741afbd90d21e6654408ea2bf2 [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
David Paterson4af1d022015-04-02 01:27:34 -040014import sys
15
16from cliff import app
17from cliff import commandmanager
Cady_Chen72014bc2016-11-16 09:43:49 +080018from oslo_log import log as logging
Matthew Treinish0ef3a732015-10-29 02:44:34 -040019from pbr import version
David Paterson4af1d022015-04-02 01:27:34 -040020
21
22class Main(app.App):
23
24 log = logging.getLogger(__name__)
25
26 def __init__(self):
27 super(Main, self).__init__(
28 description='Tempest cli application',
Masayuki Igawa70e0a892016-06-07 15:45:48 +090029 version=version.VersionInfo('tempest').version_string_with_vcs(),
David Paterson4af1d022015-04-02 01:27:34 -040030 command_manager=commandmanager.CommandManager('tempest.cm'),
Masayuki Igawa2f1f4972016-01-13 12:26:59 +090031 deferred_help=True,
David Paterson4af1d022015-04-02 01:27:34 -040032 )
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:]))