Commit eb25f6f3 by Őry Máté

one: add extra parameters to context

parent 7a31ee22
...@@ -357,7 +357,7 @@ class Instance(models.Model): ...@@ -357,7 +357,7 @@ class Instance(models.Model):
Submit a new instance to OpenNebula. Submit a new instance to OpenNebula.
""" """
@classmethod @classmethod
def submit(cls, template, owner): def submit(cls, template, owner, extra=""):
from django.template.defaultfilters import escape from django.template.defaultfilters import escape
out = "" out = ""
inst = Instance(pw=pwgen(), template=template, owner=owner) inst = Instance(pw=pwgen(), template=template, owner=owner)
...@@ -390,6 +390,7 @@ class Instance(models.Model): ...@@ -390,6 +390,7 @@ class Instance(models.Model):
<SSHPRIV>%(sshkey)s</SSHPRIV> <SSHPRIV>%(sshkey)s</SSHPRIV>
<BOOTURL>%(booturl)s</BOOTURL> <BOOTURL>%(booturl)s</BOOTURL>
<SERVER>store.cloud.ik.bme.hu</SERVER> <SERVER>store.cloud.ik.bme.hu</SERVER>
%(extra)s
</CONTEXT> </CONTEXT>
</COMPUTE>""" % {"name": u"%s %d" % (owner.username, inst.id), </COMPUTE>""" % {"name": u"%s %d" % (owner.username, inst.id),
"instance": template.instance_type, "instance": template.instance_type,
...@@ -399,7 +400,8 @@ class Instance(models.Model): ...@@ -399,7 +400,8 @@ class Instance(models.Model):
"smbpw": escape(details.smb_password), "smbpw": escape(details.smb_password),
"sshkey": escape(details.ssh_private_key), "sshkey": escape(details.ssh_private_key),
"neptun": escape(owner.username), "neptun": escape(owner.username),
"booturl": "http://cloud.ik.bme.hu/b/%s/" % token, } "booturl": "http://cloud.ik.bme.hu/b/%s/" % token,
"extra": extra}
f.write(tpl) f.write(tpl)
f.close() f.close()
import subprocess import subprocess
......
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