From 11918112a1ce77449c7e80755d04288e751cc7c0 Mon Sep 17 00:00:00 2001 From: Fredrik Vedvik Date: Fri, 3 Nov 2023 10:16:15 +0100 Subject: [PATCH] fix bmm rclone path --- workflows/export/vx_export_bmm.go | 7 ++++++- workflows/export/vx_export_playout.go | 12 +++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/workflows/export/vx_export_bmm.go b/workflows/export/vx_export_bmm.go index a0c01ed1..58142a51 100644 --- a/workflows/export/vx_export_bmm.go +++ b/workflows/export/vx_export_bmm.go @@ -133,9 +133,14 @@ func VXExportToBMM(ctx workflow.Context, params VXExportChildWorkflowParams) (*V return nil, fmt.Errorf("failed to write JSON file: %w", err) } + outputPath, err := utils.ParsePath(outputFolder) + if err != nil { + return nil, err + } + ingestFolder := params.ExportData.SafeTitle + "_" + workflow.GetInfo(ctx).OriginalRunID err = workflow.ExecuteActivity(ctx, activities.RcloneCopyDir, activities.RcloneCopyDirInput{ - Source: strings.Replace(outputFolder, utils.GetIsilonPrefix()+"/", "isilon:isilon/", 1), + Source: outputPath.RclonePath(), Destination: fmt.Sprintf("bmms3:/int-bmm-mediabanken/" + ingestFolder), }).Get(ctx, nil) if err != nil { diff --git a/workflows/export/vx_export_playout.go b/workflows/export/vx_export_playout.go index e1a376cd..b8f0922a 100644 --- a/workflows/export/vx_export_playout.go +++ b/workflows/export/vx_export_playout.go @@ -1,14 +1,12 @@ package export import ( - "path/filepath" - "strings" - "github.com/bcc-code/bccm-flows/activities" "github.com/bcc-code/bccm-flows/common" "github.com/bcc-code/bccm-flows/utils" "github.com/bcc-code/bccm-flows/utils/wfutils" "go.temporal.io/sdk/workflow" + "path/filepath" ) func VXExportToPlayout(ctx workflow.Context, params VXExportChildWorkflowParams) (*VXExportResult, error) { @@ -56,11 +54,15 @@ func VXExportToPlayout(ctx workflow.Context, params VXExportChildWorkflowParams) options.TaskQueue = utils.GetWorkerQueue() ctx = workflow.WithActivityOptions(ctx, options) + outputPath, err := utils.ParsePath(params.OutputDir) + if err != nil { + return nil, err + } + // Rclone to playout - source := strings.Replace(params.OutputDir, utils.GetIsilonPrefix()+"/", "isilon:isilon/", 1) destination := "playout:/dropbox" err = workflow.ExecuteActivity(ctx, activities.RcloneCopyDir, activities.RcloneCopyDirInput{ - Source: source, + Source: outputPath.RclonePath(), Destination: destination, }).Get(ctx, nil) if err != nil {