mirror of https://github.com/jumpserver/jumpserver
fix: account_prefer
parent
bbeadf7dbe
commit
f2404319af
|
@ -326,21 +326,9 @@ class JMSInventory:
|
||||||
'ip': host['ansible_host'],
|
'ip': host['ansible_host'],
|
||||||
'id': host.get('jms_asset', {}).get('id')
|
'id': host.get('jms_asset', {}).get('id')
|
||||||
})
|
})
|
||||||
|
|
||||||
# 获取跳过的主机
|
|
||||||
skipped_hosts = []
|
|
||||||
for name, error in self.exclude_hosts.items():
|
|
||||||
if any(h['name'] == name for h in error_hosts):
|
|
||||||
continue
|
|
||||||
skipped_hosts.append({
|
|
||||||
'name': name,
|
|
||||||
'error': error
|
|
||||||
})
|
|
||||||
|
|
||||||
result = {
|
result = {
|
||||||
'runnable': runnable_hosts,
|
'runnable': runnable_hosts,
|
||||||
'error': error_hosts,
|
'error': error_hosts,
|
||||||
'skipped': skipped_hosts
|
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ class InventoryClassifiedHostsAPI(APIView):
|
||||||
asset_ids = request.data.get('assets', [])
|
asset_ids = request.data.get('assets', [])
|
||||||
node_ids = request.data.get('nodes', [])
|
node_ids = request.data.get('nodes', [])
|
||||||
runas_policy = request.data.get('runas_policy', 'privileged_first')
|
runas_policy = request.data.get('runas_policy', 'privileged_first')
|
||||||
account_prefer = request.data.get('account_prefer', 'root,Administrator')
|
account_prefer = request.data.get('runas', 'root,Administrator')
|
||||||
module = request.data.get('module', 'shell')
|
module = request.data.get('module', 'shell')
|
||||||
# 合并节点和资产
|
# 合并节点和资产
|
||||||
assets = list(Asset.objects.filter(id__in=asset_ids).all())
|
assets = list(Asset.objects.filter(id__in=asset_ids).all())
|
||||||
|
|
Loading…
Reference in New Issue