| 1 |
# Copyright (c) 2015 SUSE Linux GmbH. All rights reserved. |
| 2 |
# |
| 3 |
# This file is part of kiwi. |
| 4 |
# |
| 5 |
# kiwi is free software: you can redistribute it and/or modify |
| 6 |
# it under the terms of the GNU General Public License as published by |
| 7 |
# the Free Software Foundation, either version 3 of the License, or |
| 8 |
# (at your option) any later version. |
| 9 |
# |
| 10 |
# kiwi is distributed in the hope that it will be useful, |
| 11 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
# GNU General Public License for more details. |
| 14 |
# |
| 15 |
# You should have received a copy of the GNU General Public License |
| 16 |
# along with kiwi. If not, see <http://www.gnu.org/licenses/> |
| 17 |
# |
| 18 |
# project |
| 19 |
from .tasks.base import CliTask |
| 20 |
|
| 21 |
|
| 22 |
class App: |
| 23 |
""" |
| 24 |
**Implements creation of task instances** |
| 25 |
|
| 26 |
Each task class implements a process method which is called |
| 27 |
when constructing an instance of App |
| 28 |
""" |
| 29 |
def __init__(self): |
| 30 |
app = CliTask(should_perform_task_setup=False) |
| 31 |
action = app.cli.get_command() |
| 32 |
service = app.cli.get_servicename() |
| 33 |
task_class_name = service.title() + action.title() + 'Task' |
| 34 |
task_class = app.task.__dict__[task_class_name] |
| 35 |
task_class().process() |