Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gyuricska Milán
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
8c20ce75
authored
Aug 19, 2014
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm: allow saving lease
fixes #252
parent
c06380e5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
1 deletions
+6
-1
circle/dashboard/forms.py
+3
-0
circle/vm/operations.py
+3
-1
No files found.
circle/dashboard/forms.py
View file @
8c20ce75
...
...
@@ -703,6 +703,8 @@ class VmRenewForm(forms.Form):
force
=
forms
.
BooleanField
(
required
=
False
,
label
=
_
(
"Set expiration times even if they are shorter than "
"the current value."
))
save
=
forms
.
BooleanField
(
required
=
False
,
label
=
_
(
"Save selected lease."
))
def
__init__
(
self
,
*
args
,
**
kwargs
):
choices
=
kwargs
.
pop
(
'choices'
)
...
...
@@ -714,6 +716,7 @@ class VmRenewForm(forms.Form):
empty_label
=
None
,
label
=
_
(
'Length'
)))
if
len
(
choices
)
<
2
:
self
.
fields
[
'lease'
]
.
widget
=
HiddenInput
()
self
.
fields
[
'save'
]
.
widget
=
HiddenInput
()
@property
def
helper
(
self
):
...
...
circle/vm/operations.py
View file @
8c20ce75
...
...
@@ -754,7 +754,7 @@ class RenewOperation(InstanceOperation):
required_perms
=
()
concurrency_check
=
False
def
_operation
(
self
,
activity
,
lease
=
None
,
force
=
False
):
def
_operation
(
self
,
activity
,
lease
=
None
,
force
=
False
,
save
=
False
):
suspend
,
delete
=
self
.
instance
.
get_renew_times
(
lease
)
if
(
not
force
and
suspend
and
self
.
instance
.
time_of_suspend
and
suspend
<
self
.
instance
.
time_of_suspend
):
...
...
@@ -768,6 +768,8 @@ class RenewOperation(InstanceOperation):
"in its delete time get earlier than before."
))
self
.
instance
.
time_of_suspend
=
suspend
self
.
instance
.
time_of_delete
=
delete
if
save
:
self
.
instance
.
lease
=
lease
self
.
instance
.
save
()
activity
.
result
=
create_readable
(
ugettext_noop
(
"Renewed to suspend at
%(suspend)
s and destroy at
%(delete)
s."
),
...
...
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