executeFileDownload downloads the file content from the pod
(ctx context.Context, pod *corev1.Pod, downloadCmd *DownloadCmd)
| 339 | |
| 340 | // executeFileDownload downloads the file content from the pod |
| 341 | func (ds *DownloadService) executeFileDownload(ctx context.Context, pod *corev1.Pod, downloadCmd *DownloadCmd) ([]byte, error) { |
| 342 | content, err := ds.createDownloadExec(ctx, pod, downloadCmd.FileReadCommand) |
| 343 | if err != nil { |
| 344 | return nil, errors.Join(ErrExecFileDownload, err) |
| 345 | } |
| 346 | |
| 347 | if content == "" { |
| 348 | return nil, ErrEmptyDownloadOutput |
| 349 | } |
| 350 | |
| 351 | return []byte(content), nil |
| 352 | } |
| 353 | |
| 354 | // createDownloadPod creates a pod for downloading files from the host |
| 355 | func (ds *DownloadService) createDownloadPod(ctx context.Context, nodeName, hostPath, captureName string, downloadCmd *DownloadCmd) (*corev1.Pod, error) { |
no test coverage detected