fix: update translation strings and improve error handling in inventory and job modules

This commit is contained in:
wangruidong
2025-04-15 16:44:13 +08:00
committed by Bryan
parent 631570b819
commit ce3daf5496
3 changed files with 102 additions and 83 deletions

View File

@@ -2,9 +2,9 @@
import json
import os
import re
import sys
from collections import defaultdict
import sys
from django.utils.translation import gettext as _
__all__ = ['JMSInventory']
@@ -319,7 +319,7 @@ class JMSInventory:
else:
runnable_hosts.append({
'name': host['name'],
'ip': host['ansible_host'],
'ip': host.get('ansible_host', ''),
'id': host.get('jms_asset', {}).get('id')
})
result = {

View File

@@ -79,7 +79,7 @@ class JMSPermedInventory(JMSInventory):
}
if self.module not in protocol_supported_modules_mapping.get(protocol.name, []):
host['error'] = "Module {} is not suitable for this asset".format(self.module)
host['error'] = _("Module {} is not suitable for this asset").format(self.module)
return host
if protocol.name in ('mariadb', 'mysql', 'postgresql', 'sqlserver'):