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
02116654
authored
May 14, 2015
by
Bach Dániel
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature-op-retval' into 'master'
Feature op retval
✅
closes #228 See merge request !328
parents
0c706599
30bd9787
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
6 deletions
+15
-6
circle/common/operations.py
+8
-3
circle/vm/operations.py
+7
-3
No files found.
circle/common/operations.py
View file @
02116654
...
...
@@ -21,7 +21,8 @@ from logging import getLogger
from
django.core.exceptions
import
PermissionDenied
,
ImproperlyConfigured
from
django.utils.translation
import
ugettext_noop
from
.models
import
activity_context
,
has_suffix
,
humanize_exception
from
.models
import
(
activity_context
,
has_suffix
,
humanize_exception
,
HumanReadableObject
)
logger
=
getLogger
(
__name__
)
...
...
@@ -110,8 +111,12 @@ class Operation(object):
arguments
.
update
(
auxargs
)
with
activity_context
(
allargs
[
'activity'
],
on_abort
=
self
.
on_abort
,
on_commit
=
self
.
on_commit
):
return
self
.
_operation
(
**
arguments
)
on_commit
=
self
.
on_commit
)
as
act
:
retval
=
self
.
_operation
(
**
arguments
)
if
(
act
.
result
is
None
and
isinstance
(
retval
,
(
basestring
,
int
,
HumanReadableObject
))):
act
.
result
=
retval
return
retval
def
_operation
(
self
,
**
kwargs
):
"""This method is the operation's particular implementation.
...
...
circle/vm/operations.py
View file @
02116654
...
...
@@ -28,6 +28,7 @@ import time
from
urlparse
import
urlsplit
from
django.core.exceptions
import
PermissionDenied
,
SuspiciousOperation
from
django.core.urlresolvers
import
reverse
from
django.utils
import
timezone
from
django.utils.translation
import
ugettext_lazy
as
_
,
ugettext_noop
from
django.conf
import
settings
...
...
@@ -794,7 +795,10 @@ class SaveAsTemplateOperation(InstanceOperation):
tmpl
.
delete
()
raise
else
:
return
tmpl
return
create_readable
(
ugettext_noop
(
"New template:
%(template)
s"
),
template
=
reverse
(
'dashboard.views.template-detail'
,
kwargs
=
{
'pk'
:
tmpl
.
pk
}))
@register_operation
...
...
@@ -986,7 +990,7 @@ class RenewOperation(InstanceOperation):
if
save
:
self
.
instance
.
lease
=
lease
self
.
instance
.
save
()
activity
.
result
=
create_readable
(
ugettext_noop
(
return
create_readable
(
ugettext_noop
(
"Renewed to suspend at
%(suspend)
s and destroy at
%(delete)
s."
),
suspend
=
suspend
,
delete
=
delete
)
...
...
@@ -1357,7 +1361,7 @@ class ResourcesOperation(InstanceOperation):
self
.
instance
.
full_clean
()
self
.
instance
.
save
()
activity
.
result
=
create_readable
(
ugettext_noop
(
return
create_readable
(
ugettext_noop
(
"Priority:
%(priority)
s, Num cores:
%(num_cores)
s, "
"Ram size:
%(ram_size)
s"
),
priority
=
priority
,
num_cores
=
num_cores
,
ram_size
=
ram_size
...
...
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