mirror of https://github.com/jumpserver/jumpserver
commit
0666b1e747
|
@ -1,24 +1,24 @@
|
||||||
# ~*~ coding: utf-8 ~*~
|
# ~*~ coding: utf-8 ~*~
|
||||||
from functools import partial
|
|
||||||
from collections import namedtuple, defaultdict
|
from collections import namedtuple, defaultdict
|
||||||
|
from functools import partial
|
||||||
|
|
||||||
from django.db.models.signals import m2m_changed
|
from django.db.models.signals import m2m_changed
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from rest_framework import status
|
from rest_framework import status
|
||||||
from rest_framework.response import Response
|
|
||||||
from rest_framework.decorators import action
|
from rest_framework.decorators import action
|
||||||
from rest_framework.generics import get_object_or_404
|
from rest_framework.generics import get_object_or_404
|
||||||
|
from rest_framework.response import Response
|
||||||
from rest_framework.serializers import ValidationError
|
from rest_framework.serializers import ValidationError
|
||||||
|
|
||||||
from assets.models import Asset
|
from assets.models import Asset
|
||||||
from common.const.http import POST
|
|
||||||
from common.utils import get_logger
|
|
||||||
from common.api import SuggestionMixin
|
from common.api import SuggestionMixin
|
||||||
from common.exceptions import SomeoneIsDoingThis
|
from common.const.http import POST
|
||||||
from common.const.signals import PRE_REMOVE, POST_REMOVE
|
from common.const.signals import PRE_REMOVE, POST_REMOVE
|
||||||
|
from common.exceptions import SomeoneIsDoingThis
|
||||||
|
from common.utils import get_logger
|
||||||
from orgs.mixins import generics
|
from orgs.mixins import generics
|
||||||
from orgs.utils import current_org
|
|
||||||
from orgs.mixins.api import OrgBulkModelViewSet
|
from orgs.mixins.api import OrgBulkModelViewSet
|
||||||
|
from orgs.utils import current_org
|
||||||
from .. import serializers
|
from .. import serializers
|
||||||
from ..models import Node
|
from ..models import Node
|
||||||
from ..tasks import (
|
from ..tasks import (
|
||||||
|
@ -210,7 +210,7 @@ class NodeTaskCreateApi(generics.CreateAPIView):
|
||||||
return
|
return
|
||||||
|
|
||||||
if action == "refresh":
|
if action == "refresh":
|
||||||
task = update_node_assets_hardware_info_manual.delay(node.id)
|
task = update_node_assets_hardware_info_manual(node.id)
|
||||||
else:
|
else:
|
||||||
task = test_node_assets_connectivity_manual.delay(node.id)
|
task = test_node_assets_connectivity_manual(node.id)
|
||||||
self.set_serializer_data(serializer, task)
|
self.set_serializer_data(serializer, task)
|
||||||
|
|
|
@ -40,4 +40,4 @@ def test_node_assets_connectivity_manual(node_id):
|
||||||
node = Node.objects.get(id=node_id)
|
node = Node.objects.get(id=node_id)
|
||||||
task_name = gettext_noop("Test if the assets under the node are connectable ")
|
task_name = gettext_noop("Test if the assets under the node are connectable ")
|
||||||
assets = node.get_all_assets()
|
assets = node.get_all_assets()
|
||||||
return test_assets_connectivity_task.delay(*assets, task_name)
|
return test_assets_connectivity_task.delay(assets, task_name)
|
||||||
|
|
|
@ -117,7 +117,10 @@ class JMSInventory:
|
||||||
if host['jms_account'] and asset.platform.type == 'oracle':
|
if host['jms_account'] and asset.platform.type == 'oracle':
|
||||||
host['jms_account']['mode'] = 'sysdba' if account.privileged else None
|
host['jms_account']['mode'] = 'sysdba' if account.privileged else None
|
||||||
|
|
||||||
ansible_config = dict(automation.ansible_config)
|
try:
|
||||||
|
ansible_config = dict(automation.ansible_config)
|
||||||
|
except Exception as e:
|
||||||
|
ansible_config = {}
|
||||||
ansible_connection = ansible_config.get('ansible_connection', 'ssh')
|
ansible_connection = ansible_config.get('ansible_connection', 'ssh')
|
||||||
host.update(ansible_config)
|
host.update(ansible_config)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue