Update some bug

pull/417/head
ibuler 8 years ago
parent 5a5d5bdd51
commit be09db059d

@ -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):

@ -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'),

@ -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}))

Loading…
Cancel
Save