Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
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
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
Commit
e601b2bc
authored
Jul 24, 2014
by
Őry Máté
Committed by
Bach Dániel
Jul 26, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: allow waiting for Operation result
parent
4d19cb51
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
2 deletions
+18
-2
circle/dashboard/views.py
+18
-2
No files found.
circle/dashboard/views.py
View file @
e601b2bc
...
@@ -52,6 +52,7 @@ from django_tables2 import SingleTableView
...
@@ -52,6 +52,7 @@ from django_tables2 import SingleTableView
from
braces.views
import
(
LoginRequiredMixin
,
SuperuserRequiredMixin
,
from
braces.views
import
(
LoginRequiredMixin
,
SuperuserRequiredMixin
,
PermissionRequiredMixin
)
PermissionRequiredMixin
)
from
braces.views._access
import
AccessMixin
from
braces.views._access
import
AccessMixin
from
celery.exceptions
import
TimeoutError
from
django_sshkey.models
import
UserKey
from
django_sshkey.models
import
UserKey
...
@@ -569,12 +570,27 @@ class OperationView(RedirectToLoginMixin, DetailView):
...
@@ -569,12 +570,27 @@ class OperationView(RedirectToLoginMixin, DetailView):
extra
=
{}
extra
=
{}
result
=
None
result
=
None
try
:
try
:
self
.
get_op
()
.
async
(
user
=
request
.
user
,
**
extra
)
task
=
self
.
get_op
()
.
async
(
user
=
request
.
user
,
**
extra
)
except
Exception
as
e
:
except
Exception
as
e
:
messages
.
error
(
request
,
_
(
'Could not start operation.'
))
messages
.
error
(
request
,
_
(
'Could not start operation.'
))
logger
.
exception
(
e
)
logger
.
exception
(
e
)
result
=
e
result
=
e
else
:
else
:
wait
=
self
.
wait_for_result
if
wait
:
try
:
result
=
task
.
get
(
timeout
=
wait
,
interval
=
min
((
wait
/
5
,
.
5
)))
except
TimeoutError
:
logger
.
debug
(
"Result didn't arrive in
%
ss"
,
self
.
wait_for_result
,
exc_info
=
True
)
except
Exception
as
e
:
messages
.
error
(
request
,
_
(
'Operation failed.'
))
logger
.
debug
(
"Operation failed."
,
exc_info
=
True
)
result
=
e
else
:
messages
.
success
(
request
,
_
(
'Operation succeeded.'
))
if
result
is
None
:
messages
.
success
(
request
,
_
(
'Operation is started.'
))
messages
.
success
(
request
,
_
(
'Operation is started.'
))
if
"/json"
in
request
.
META
.
get
(
"HTTP_ACCEPT"
,
""
):
if
"/json"
in
request
.
META
.
get
(
"HTTP_ACCEPT"
,
""
):
...
@@ -863,7 +879,7 @@ vm_ops = OrderedDict([
...
@@ -863,7 +879,7 @@ vm_ops = OrderedDict([
(
'resources_change'
,
VmResourcesChangeView
),
(
'resources_change'
,
VmResourcesChangeView
),
(
'password_reset'
,
VmOperationView
.
factory
(
(
'password_reset'
,
VmOperationView
.
factory
(
op
=
'password_reset'
,
icon
=
'unlock'
,
effect
=
'warning'
,
op
=
'password_reset'
,
icon
=
'unlock'
,
effect
=
'warning'
,
show_in_toolbar
=
False
)),
show_in_toolbar
=
False
,
wait_for_result
=
0.5
)),
])
])
...
...
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