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
e5b9cb0f
authored
9 years ago
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
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
13 deletions
+35
-13
circle/vm/operations.py
+35
-13
No files found.
circle/vm/operations.py
View file @
e5b9cb0f
...
@@ -973,26 +973,48 @@ class RenewOperation(InstanceOperation):
...
@@ -973,26 +973,48 @@ class RenewOperation(InstanceOperation):
required_perms
=
()
required_perms
=
()
concurrency_check
=
False
concurrency_check
=
False
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."
))
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_delete
=
delete
def
_operation
(
self
,
activity
,
lease
=
None
,
force
=
False
,
save
=
False
):
def
_operation
(
self
,
activity
,
lease
=
None
,
force
=
False
,
save
=
False
):
suspend
,
delete
=
self
.
instance
.
get_renew_times
(
lease
)
suspend
,
delete
=
self
.
instance
.
get_renew_times
(
lease
)
if
(
not
force
and
suspend
and
self
.
instance
.
time_of_suspend
and
try
:
suspend
<
self
.
instance
.
time_of_suspend
):
self
.
set_time_of_suspend
(
activity
,
suspend
,
force
)
raise
HumanReadableException
.
create
(
ugettext_noop
(
except
HumanReadableException
:
"Renewing the machine with the selected lease would result "
pass
"in its suspension time get earlier than before."
))
try
:
if
(
not
force
and
delete
and
self
.
instance
.
time_of_delete
and
self
.
set_time_of_delete
(
activity
,
delete
,
force
)
delete
<
self
.
instance
.
time_of_delete
):
except
HumanReadableException
:
raise
HumanReadableException
.
create
(
ugettext_noop
(
pass
"Renewing the machine with the selected lease would result "
"in its delete time get earlier than before."
))
self
.
instance
.
time_of_suspend
=
suspend
self
.
instance
.
time_of_delete
=
delete
if
save
:
if
save
:
self
.
instance
.
lease
=
lease
self
.
instance
.
lease
=
lease
self
.
instance
.
save
()
self
.
instance
.
save
()
return
create_readable
(
ugettext_noop
(
return
create_readable
(
ugettext_noop
(
"Renewed to suspend at
%(suspend)
s and destroy at
%(delete)
s."
),
"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
@register_operation
...
...
This diff is collapsed.
Click to expand it.
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