Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
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
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
Hide 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):
...
@@ -359,19 +359,18 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
params
=
dict
(
template
=
template
,
owner
=
owner
,
pw
=
pwgen
())
params
=
dict
(
template
=
template
,
owner
=
owner
,
pw
=
pwgen
())
params
.
update
([(
f
,
getattr
(
template
,
f
))
for
f
in
common_fields
])
params
.
update
([(
f
,
getattr
(
template
,
f
))
for
f
in
common_fields
])
params
.
update
(
kwargs
)
# override defaults w/ user supplied values
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'
params
[
'name'
]
+=
'
%
d'
instances
=
[]
customized_params
=
(
dict
(
params
,
for
i
in
xrange
(
amount
):
name
=
params
[
'name'
]
.
replace
(
'
%
d'
,
str
(
i
)))
real_params
=
params
for
i
in
xrange
(
amount
))
real_params
[
'name'
]
=
real_params
[
'name'
]
.
replace
(
'
%
d'
,
str
(
i
))
return
[
cls
.
create
(
cps
,
disks
,
networks
,
req_traits
,
tags
)
instances
.
append
(
cls
.
__create_instance
(
real_params
,
disks
,
for
cps
in
customized_params
]
networks
,
req_traits
,
tags
))
return
instances
@classmethod
@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
# create instance and do additional setup
inst
=
cls
(
**
params
)
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