perf: 上传目标目录指定在/tmp下 (#12334)

Co-authored-by: wangruidong <940853815@qq.com>
pull/12337/head
fit2bot 12 months ago committed by GitHub
parent 438e9dee2a
commit e3c0518cfb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -93,7 +93,7 @@ class UploadFileRunner:
self.cb = DefaultCallback()
upload_file_dir = safe_join(settings.DATA_DIR, 'job_upload_file')
self.src_paths = safe_join(upload_file_dir, str(job_id))
self.dest_path = dest_path
self.dest_path = safe_join("/tmp", dest_path)
def run(self, verbosity=0, **kwargs):
verbosity = get_ansible_log_verbosity(verbosity)

@ -68,7 +68,7 @@ class JobViewSet(OrgBulkModelViewSet):
def get_queryset(self):
queryset = super().get_queryset()
queryset = queryset.filter(creator=self.request.user)
queryset = queryset.filter(creator=self.request.user).exclude(type=Types.upload_file)
if self.action != 'retrieve':
return queryset.filter(instant=False)
return queryset

@ -381,11 +381,8 @@ class JobExecution(JMSOrgBaseModel):
elif self.current_job.type == Types.upload_file:
job_id = self.current_job.id
args = json.loads(self.current_job.args)
dst_path = args.get('dst_path')
if dst_path:
runner = UploadFileRunner(self.inventory_path, job_id, dst_path)
else:
raise ValueError("dst_path is null")
dst_path = args.get('dst_path', '/')
runner = UploadFileRunner(self.inventory_path, job_id, dst_path)
else:
raise Exception("unsupported job type")
return runner

Loading…
Cancel
Save