David Paterson | 4af1d02 | 2015-04-02 01:27:34 -0400 | [diff] [blame] | 1 | # 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 | |
| 14 | import logging |
| 15 | import sys |
| 16 | |
| 17 | from cliff import app |
| 18 | from cliff import commandmanager |
| 19 | |
| 20 | TEMPEST_CLI_VERSION = '0.1' |
| 21 | |
| 22 | |
| 23 | class 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 | |
| 46 | def main(argv=sys.argv[1:]): |
| 47 | the_app = Main() |
| 48 | return the_app.run(argv) |
| 49 | |
| 50 | |
| 51 | if __name__ == '__main__': |
| 52 | sys.exit(main(sys.argv[1:])) |