feat: 支持执行目录切换,修改字段显示

This commit is contained in:
Aaron3S
2022-11-30 16:24:17 +08:00
parent 25b9739ce3
commit dcbdb0af4d
3 changed files with 14 additions and 7 deletions

View File

@@ -113,6 +113,13 @@ class JobExecution(JMSOrgBaseModel):
def job_type(self):
return self.job.type
def compile_shell(self):
if self.job.type != 'adhoc':
return
result = "{}{}{} ".format('\'', self.job.args, '\'')
result += "chdir={}".format(self.job.chdir)
return result
def get_runner(self):
inv = self.job.inventory
inv.write_to_file(self.inventory_path)
@@ -122,8 +129,9 @@ class JobExecution(JMSOrgBaseModel):
extra_vars = {}
if self.job.type == 'adhoc':
args = self.compile_shell()
runner = AdHocRunner(
self.inventory_path, self.job.module, module_args=self.job.args,
self.inventory_path, self.job.module, module_args=args,
pattern="all", project_dir=self.private_dir, extra_vars=extra_vars,
)
elif self.job.type == 'playbook':