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
e5b9cb0f
authored
May 28, 2015
by
Bach Dániel
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fix-renew' into 'master'
Fix renew
✅
closes
#375
See merge request
!334
parents
3122ce02
707287be
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
8 deletions
+30
-8
circle/vm/operations.py
+30
-8
No files found.
circle/vm/operations.py
View file @
e5b9cb0f
...
...
@@ -973,26 +973,48 @@ class RenewOperation(InstanceOperation):
required_perms
=
()
concurrency_check
=
False
def
_operation
(
self
,
activity
,
lease
=
None
,
force
=
False
,
save
=
False
):
suspend
,
delete
=
self
.
instance
.
get_renew_times
(
lease
)
def
set_time_of_suspend
(
self
,
activity
,
suspend
,
force
):
with
activity
.
sub_activity
(
'renew_suspend'
,
concurrency_check
=
False
,
readable_name
=
ugettext_noop
(
'set time of suspend'
)):
if
(
not
force
and
suspend
and
self
.
instance
.
time_of_suspend
and
suspend
<
self
.
instance
.
time_of_suspend
):
raise
HumanReadableException
.
create
(
ugettext_noop
(
"Renewing the machine with the selected lease would result "
"in its suspension time get earlier than before."
))
"Renewing the machine with the selected lease would "
"result in its suspension time get earlier than before."
))
self
.
instance
.
time_of_suspend
=
suspend
def
set_time_of_delete
(
self
,
activity
,
delete
,
force
):
with
activity
.
sub_activity
(
'renew_delete'
,
concurrency_check
=
False
,
readable_name
=
ugettext_noop
(
'set time of delete'
)):
if
(
not
force
and
delete
and
self
.
instance
.
time_of_delete
and
delete
<
self
.
instance
.
time_of_delete
):
raise
HumanReadableException
.
create
(
ugettext_noop
(
"Renewing the machine with the selected lease would result "
"in its delete time get earlier than before."
))
self
.
instance
.
time_of_suspend
=
suspend
"Renewing the machine with the selected lease would "
"result in its delete time get earlier than before."
))
self
.
instance
.
time_of_delete
=
delete
def
_operation
(
self
,
activity
,
lease
=
None
,
force
=
False
,
save
=
False
):
suspend
,
delete
=
self
.
instance
.
get_renew_times
(
lease
)
try
:
self
.
set_time_of_suspend
(
activity
,
suspend
,
force
)
except
HumanReadableException
:
pass
try
:
self
.
set_time_of_delete
(
activity
,
delete
,
force
)
except
HumanReadableException
:
pass
if
save
:
self
.
instance
.
lease
=
lease
self
.
instance
.
save
()
return
create_readable
(
ugettext_noop
(
"Renewed to suspend at
%(suspend)
s and destroy at
%(delete)
s."
),
suspend
=
suspend
,
delete
=
delete
)
suspend
=
self
.
instance
.
time_of_suspend
,
delete
=
self
.
instance
.
time_of_suspend
)
@register_operation
...
...
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