mirror of https://github.com/jumpserver/jumpserver
fix: 华为交换机执行快捷命令报错
parent
afa1ba4f6b
commit
22d70eb416
|
@ -115,6 +115,10 @@ class JMSInventory:
|
||||||
else:
|
else:
|
||||||
host.update(self.make_account_ansible_vars(account))
|
host.update(self.make_account_ansible_vars(account))
|
||||||
|
|
||||||
|
if platform.name == 'Huawei':
|
||||||
|
host['ansible_connection'] = 'network_cli'
|
||||||
|
host['ansible_network_os'] = 'asa'
|
||||||
|
|
||||||
if gateway:
|
if gateway:
|
||||||
ansible_connection = host.get('ansible_connection', 'ssh')
|
ansible_connection = host.get('ansible_connection', 'ssh')
|
||||||
if ansible_connection in ('local', 'winrm', 'rdp'):
|
if ansible_connection in ('local', 'winrm', 'rdp'):
|
||||||
|
|
|
@ -54,6 +54,7 @@ class JobModules(models.TextChoices):
|
||||||
postgresql = 'postgresql', _('PostgreSQL')
|
postgresql = 'postgresql', _('PostgreSQL')
|
||||||
sqlserver = 'sqlserver', _('SQLServer')
|
sqlserver = 'sqlserver', _('SQLServer')
|
||||||
raw = 'raw', _('Raw')
|
raw = 'raw', _('Raw')
|
||||||
|
huawei = 'huawei', _('HUAWEI')
|
||||||
|
|
||||||
|
|
||||||
class AdHocModules(models.TextChoices):
|
class AdHocModules(models.TextChoices):
|
||||||
|
|
|
@ -66,7 +66,7 @@ class JMSPermedInventory(JMSInventory):
|
||||||
'mysql': ['mysql'],
|
'mysql': ['mysql'],
|
||||||
'postgresql': ['postgresql'],
|
'postgresql': ['postgresql'],
|
||||||
'sqlserver': ['sqlserver'],
|
'sqlserver': ['sqlserver'],
|
||||||
'ssh': ['shell', 'python', 'win_shell', 'raw'],
|
'ssh': ['shell', 'python', 'win_shell', 'raw', 'huawei'],
|
||||||
'winrm': ['win_shell', 'shell'],
|
'winrm': ['win_shell', 'shell'],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -301,6 +301,11 @@ class JobExecution(JMSOrgBaseModel):
|
||||||
shell += " chdir={}".format(self.current_job.chdir)
|
shell += " chdir={}".format(self.current_job.chdir)
|
||||||
if self.current_job.module in ['python']:
|
if self.current_job.module in ['python']:
|
||||||
shell += " executable={}".format(self.current_job.module)
|
shell += " executable={}".format(self.current_job.module)
|
||||||
|
|
||||||
|
if module == JobModules.huawei.value:
|
||||||
|
module = 'ce_command'
|
||||||
|
shell = "commands=\"{}\" ".format(self.current_job.args)
|
||||||
|
|
||||||
return module, shell
|
return module, shell
|
||||||
|
|
||||||
def get_runner(self):
|
def get_runner(self):
|
||||||
|
|
Loading…
Reference in New Issue