Commit 20f8ce8f by Karsa Zoltán István

ci integraion init

parent 2ee7f788
...@@ -193,6 +193,23 @@ class Disk(object): ...@@ -193,6 +193,23 @@ class Disk(object):
return True return True
return False return False
def create_ci_disk(self, meta_data, user_data):
disk_path = self.get_path()
logger.info("Create CI iso to %s", disk_path)
print("Create CI iso to %s", disk_path)
with open(self.dir + '/meta-data', 'w') as f:
f.write(meta_data)
with open(self.dir + '/user-data', 'w') as f:
f.write(user_data)
cmdline = ['genisoimage',
'-output', self.get_path(),
'-V', 'cidata', '-r', '-J',
self.dir + '/meta-data',
self.dir + '/user-data']
subprocess.check_output(cmdline)
self.size = Disk.get(self.dir, self.name).size
def download(self, task, url, parent_id=None): # noqa def download(self, task, url, parent_id=None): # noqa
"""Download image from url.""" """Download image from url."""
disk_path = self.get_path() disk_path = self.get_path()
......
...@@ -28,6 +28,12 @@ def create(disk_desc): ...@@ -28,6 +28,12 @@ def create(disk_desc):
disk.create() disk.create()
@celery.task()
def create_ci_disk(disk_desc, meta_data, user_data):
disk = Disk.deserialize(disk_desc)
disk.create_ci_disk(meta_data=meta_data, user_data=user_data)
class download(AbortableTask): class download(AbortableTask):
time_limit = 18000 # TODO: calculate proper value it's 5h now time_limit = 18000 # TODO: calculate proper value it's 5h now
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment