Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
Commit
eb25f6f3
authored
Feb 08, 2013
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
one: add extra parameters to context
parent
7a31ee22
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
one/models.py
+4
-2
No files found.
one/models.py
View file @
eb25f6f3
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment