Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
circlestack
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
c1f12679
authored
Aug 19, 2014
by
Guba Sándor
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature-save-lease' into 'master'
Feature Save Lease
parents
7212fdbc
8c20ce75
Show 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 @
c1f12679
...
@@ -695,6 +695,8 @@ class VmRenewForm(forms.Form):
...
@@ -695,6 +695,8 @@ class VmRenewForm(forms.Form):
force
=
forms
.
BooleanField
(
required
=
False
,
label
=
_
(
force
=
forms
.
BooleanField
(
required
=
False
,
label
=
_
(
"Set expiration times even if they are shorter than "
"Set expiration times even if they are shorter than "
"the current value."
))
"the current value."
))
save
=
forms
.
BooleanField
(
required
=
False
,
label
=
_
(
"Save selected lease."
))
def
__init__
(
self
,
*
args
,
**
kwargs
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
choices
=
kwargs
.
pop
(
'choices'
)
choices
=
kwargs
.
pop
(
'choices'
)
...
@@ -706,6 +708,7 @@ class VmRenewForm(forms.Form):
...
@@ -706,6 +708,7 @@ class VmRenewForm(forms.Form):
empty_label
=
None
,
label
=
_
(
'Length'
)))
empty_label
=
None
,
label
=
_
(
'Length'
)))
if
len
(
choices
)
<
2
:
if
len
(
choices
)
<
2
:
self
.
fields
[
'lease'
]
.
widget
=
HiddenInput
()
self
.
fields
[
'lease'
]
.
widget
=
HiddenInput
()
self
.
fields
[
'save'
]
.
widget
=
HiddenInput
()
@property
@property
def
helper
(
self
):
def
helper
(
self
):
...
...
circle/vm/operations.py
View file @
c1f12679
...
@@ -754,7 +754,7 @@ class RenewOperation(InstanceOperation):
...
@@ -754,7 +754,7 @@ class RenewOperation(InstanceOperation):
required_perms
=
()
required_perms
=
()
concurrency_check
=
False
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
)
suspend
,
delete
=
self
.
instance
.
get_renew_times
(
lease
)
if
(
not
force
and
suspend
and
self
.
instance
.
time_of_suspend
and
if
(
not
force
and
suspend
and
self
.
instance
.
time_of_suspend
and
suspend
<
self
.
instance
.
time_of_suspend
):
suspend
<
self
.
instance
.
time_of_suspend
):
...
@@ -768,6 +768,8 @@ class RenewOperation(InstanceOperation):
...
@@ -768,6 +768,8 @@ class RenewOperation(InstanceOperation):
"in its delete time get earlier than before."
))
"in its delete time get earlier than before."
))
self
.
instance
.
time_of_suspend
=
suspend
self
.
instance
.
time_of_suspend
=
suspend
self
.
instance
.
time_of_delete
=
delete
self
.
instance
.
time_of_delete
=
delete
if
save
:
self
.
instance
.
lease
=
lease
self
.
instance
.
save
()
self
.
instance
.
save
()
activity
.
result
=
create_readable
(
ugettext_noop
(
activity
.
result
=
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."
),
...
...
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