[Kimchi-devel] [PATCH] Adjust Mockmodel to use the Task API from Wok
Aline Manera
alinefm at linux.vnet.ibm.com
Wed Oct 14 19:13:29 UTC 2015
Signed-off-by: Aline Manera <alinefm at linux.vnet.ibm.com>
---
src/wok/plugins/kimchi/mockmodel.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/wok/plugins/kimchi/mockmodel.py b/src/wok/plugins/kimchi/mockmodel.py
index 0832b20..5b57bbd 100644
--- a/src/wok/plugins/kimchi/mockmodel.py
+++ b/src/wok/plugins/kimchi/mockmodel.py
@@ -26,6 +26,7 @@ from lxml import objectify
from lxml.builder import E
from wok.exception import NotFoundError, OperationFailed
+from wok.model.tasks import TaskModel
from wok.objectstore import ObjectStore
from wok.utils import add_task, get_next_clone_name, wok_log
from wok.xmlutils.utils import xml_item_update
@@ -99,6 +100,8 @@ class MockModel(Model):
super(MockModel, self).__init__('test:///default', objstore_loc)
self.objstore_loc = objstore_loc
self.objstore = ObjectStore(objstore_loc)
+ kargs = {'objstore': self.objstore}
+ self.task = TaskModel(**kargs)
# The MockModel methods are instantiated on runtime according to Model
# and BaseModel
@@ -371,7 +374,7 @@ class MockModel(Model):
def _mock_host_swupdate(self, args=None):
task_id = add_task('/plugins/kimchi/host/swupdate',
self._mock_swupdate.doUpdate, self.objstore)
- return self.task_lookup(task_id)
+ return self.task.lookup(task_id)
def _mock_repositories_get_list(self):
return self._mock_repositories.repos.keys()
@@ -424,7 +427,7 @@ class MockModel(Model):
taskid = add_task(u'/plugins/kimchi/vms/%s/snapshots/%s' %
(vm_name, name), self._vmsnapshots_create_task,
self.objstore, params)
- return self.task_lookup(taskid)
+ return self.task.lookup(taskid)
def _vmsnapshots_create_task(self, cb, params):
vm_name = params['vm_name']
--
2.1.0
More information about the Kimchi-devel
mailing list