Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
839207de
authored
Mar 09, 2014
by
Dudás Ádám
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm: make public create method from private __create_instance
parent
70d27ff2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
9 deletions
+8
-9
circle/vm/models/instance.py
+8
-9
No files found.
circle/vm/models/instance.py
View file @
839207de
...
...
@@ -359,19 +359,18 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
params
=
dict
(
template
=
template
,
owner
=
owner
,
pw
=
pwgen
())
params
.
update
([(
f
,
getattr
(
template
,
f
))
for
f
in
common_fields
])
params
.
update
(
kwargs
)
# override defaults w/ user supplied values
if
'
%
d'
not
in
params
[
'name'
]:
if
amount
>
1
and
'
%
d'
not
in
params
[
'name'
]:
params
[
'name'
]
+=
'
%
d'
instances
=
[]
for
i
in
xrange
(
amount
):
real_params
=
params
real_params
[
'name'
]
=
real_params
[
'name'
]
.
replace
(
'
%
d'
,
str
(
i
))
instances
.
append
(
cls
.
__create_instance
(
real_params
,
disks
,
networks
,
req_traits
,
tags
))
return
instances
customized_params
=
(
dict
(
params
,
name
=
params
[
'name'
]
.
replace
(
'
%
d'
,
str
(
i
)))
for
i
in
xrange
(
amount
))
return
[
cls
.
create
(
cps
,
disks
,
networks
,
req_traits
,
tags
)
for
cps
in
customized_params
]
@classmethod
def
__create_instanc
e
(
cls
,
params
,
disks
,
networks
,
req_traits
,
tags
):
def
creat
e
(
cls
,
params
,
disks
,
networks
,
req_traits
,
tags
):
# create instance and do additional setup
inst
=
cls
(
**
params
)
...
...
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