Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
jumpserver
Commits
be09db05
Commit
be09db05
authored
Apr 04, 2017
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update some bug
parent
5a5d5bdd
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
15 deletions
+9
-15
tasks.py
apps/assets/tasks.py
+8
-5
views_urls.py
apps/assets/urls/views_urls.py
+0
-1
asset.py
apps/assets/views/asset.py
+1
-9
No files found.
apps/assets/tasks.py
View file @
be09db05
...
...
@@ -53,14 +53,17 @@ def update_assets_hardware_info(assets):
asset
.
save
()
@shared_task
(
name
=
"asset_test_ping_check"
)
def
asset_test_ping_check
(
assets
):
@shared_task
def
test_admin_user_connective
(
assets
=
None
):
if
None
:
assets
=
Asset
.
objects
.
filter
(
type__in
=
[
'Server'
,
'VM'
])
if
not
assets
:
return
'No asset get'
task_tuple
=
(
(
'ping'
,
''
),
)
hoc
=
AdHocRunner
(
assets
)
result
=
hoc
.
run
(
task_tuple
)
return
result
[
'contacted'
]
.
keys
(),
result
[
'dark'
]
.
keys
()
summary
,
result
=
run_AdHoc
(
task_tuple
,
assets
,
record
=
False
)
return
summary
,
result
def
get_assets_hardware_info
(
assets
):
...
...
apps/assets/urls/views_urls.py
View file @
be09db05
...
...
@@ -14,7 +14,6 @@ urlpatterns = [
url
(
r'^asset/(?P<pk>[0-9]+)/$'
,
views
.
AssetDetailView
.
as_view
(),
name
=
'asset-detail'
),
url
(
r'^asset/(?P<pk>[0-9]+)/update/$'
,
views
.
AssetUpdateView
.
as_view
(),
name
=
'asset-update'
),
url
(
r'^asset/(?P<pk>[0-9]+)/delete/$'
,
views
.
AssetDeleteView
.
as_view
(),
name
=
'asset-delete'
),
url
(
r'^asset/(?P<pk>[0-9]+)/refresh/$'
,
views
.
AssetRefreshHardwareView
.
as_view
(),
name
=
'asset-refresh'
),
url
(
r'^asset-modal$'
,
views
.
AssetModalListView
.
as_view
(),
name
=
'asset-modal-list'
),
url
(
r'^asset-modal-update$'
,
views
.
AssetModalCreateView
.
as_view
(),
name
=
'asset-modal-update'
),
...
...
apps/assets/views/asset.py
View file @
be09db05
...
...
@@ -32,7 +32,7 @@ from ..tasks import update_assets_hardware_info
__all__
=
[
'AssetListView'
,
'AssetCreateView'
,
'AssetUpdateView'
,
'UserAssetListView'
,
'AssetModalCreateView'
,
'AssetDetailView'
,
'AssetModalListView'
,
'AssetDeleteView'
,
'AssetExportView'
,
'BulkImportAssetView'
,
'AssetRefreshHardwareView'
,
'BulkImportAssetView'
,
]
...
...
@@ -329,11 +329,3 @@ class BulkImportAssetView(AdminUserRequiredMixin, JSONResponseMixin, FormView):
return
self
.
render_json_response
(
data
)
class
AssetRefreshHardwareView
(
AdminUserRequiredMixin
,
View
):
def
get
(
self
,
request
,
*
args
,
**
kwargs
):
asset_id
=
kwargs
.
get
(
'pk'
)
asset
=
get_object_or_404
(
Asset
,
pk
=
asset_id
)
update_assets_hardware_info
([
asset
])
return
redirect
(
reverse
(
'assets:asset-detail'
,
kwargs
=
{
'pk'
:
asset_id
}))
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