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
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
Commit
b0c5e369
authored
Mar 06, 2014
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm: extract Instance._do_renew
Fixes unit tests.
parent
9f93161b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
+11
-6
circle/vm/models/instance.py
+11
-6
No files found.
circle/vm/models/instance.py
View file @
b0c5e369
...
...
@@ -302,7 +302,7 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
def
clean
(
self
,
*
args
,
**
kwargs
):
if
self
.
time_of_delete
is
None
:
self
.
renew
(
which
=
'delete'
)
self
.
_do_
renew
(
which
=
'delete'
)
super
(
Instance
,
self
)
.
clean
(
*
args
,
**
kwargs
)
@classmethod
...
...
@@ -632,6 +632,15 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
timezone
.
now
()
+
self
.
lease
.
suspend_interval
,
timezone
.
now
()
+
self
.
lease
.
delete_interval
)
def
_do_renew
(
self
,
which
=
'both'
):
"""Set expiration times to renewed values.
"""
time_of_suspend
,
time_of_delete
=
self
.
get_renew_times
()
if
which
in
(
'suspend'
,
'both'
):
self
.
time_of_suspend
=
time_of_suspend
if
which
in
(
'delete'
,
'both'
):
self
.
time_of_delete
=
time_of_delete
def
renew
(
self
,
which
=
'both'
,
base_activity
=
None
,
user
=
None
):
"""Renew virtual machine instance leases.
"""
...
...
@@ -643,11 +652,7 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
with
act
:
if
which
not
in
(
'suspend'
,
'delete'
,
'both'
):
raise
ValueError
(
'No such expiration type.'
)
time_of_suspend
,
time_of_delete
=
self
.
get_renew_times
()
if
which
in
(
'suspend'
,
'both'
):
self
.
time_of_suspend
=
time_of_suspend
if
which
in
(
'delete'
,
'both'
):
self
.
time_of_delete
=
time_of_delete
self
.
_do_renew
(
which
)
self
.
save
()
def
change_password
(
self
,
user
=
None
):
...
...
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