[Kimchi-devel] [PATCH 15/16] Move all resources related to tasks to control/tasks.py
Aline Manera
alinefm at linux.vnet.ibm.com
Mon Dec 23 18:41:30 UTC 2013
From: Aline Manera <alinefm at br.ibm.com>
Tasks(Collection) and Task(Resource) were moved to a new - control/tasks.py
That way we can easily know where task resource is implemented.
Signed-off-by: Aline Manera <alinefm at br.ibm.com>
---
Makefile.am | 1 +
src/kimchi/control/tasks.py | 41 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 42 insertions(+)
create mode 100644 src/kimchi/control/tasks.py
diff --git a/Makefile.am b/Makefile.am
index 7278a9b..d9daa63 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -54,6 +54,7 @@ PEP8_WHITELIST = \
src/kimchi/control/plugins.py \
src/kimchi/control/storagepools.py \
src/kimchi/control/storagevolumes.py \
+ src/kimchi/control/tasks.py \
src/kimchi/control/templates.py \
src/kimchi/control/utils.py \
src/kimchi/control/vms.py \
diff --git a/src/kimchi/control/tasks.py b/src/kimchi/control/tasks.py
new file mode 100644
index 0000000..43f232e
--- /dev/null
+++ b/src/kimchi/control/tasks.py
@@ -0,0 +1,41 @@
+#
+# Project Kimchi
+#
+# Copyright IBM, Corp. 2013
+#
+# Authors:
+# Adam Litke <agl at linux.vnet.ibm.com>
+# Aline Manera <alinefm at linux.vnet.ibm.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+from kimchi.control.base import Collection, Resource
+
+
+class Tasks(Collection):
+ def __init__(self, model):
+ super(Tasks, self).__init__(model)
+ self.resource = Task
+
+
+class Task(Resource):
+ def __init__(self, model, id):
+ super(Task, self).__init__(model, id)
+
+ @property
+ def data(self):
+ return {'id': self.ident,
+ 'status': self.info['status'],
+ 'message': self.info['message']}
--
1.7.10.4
More information about the Kimchi-devel
mailing list