From d27596b24a097e70d1c5b4cdcb8bb7096788ce96 Mon Sep 17 00:00:00 2001 From: Christian Kellner Date: Fri, 20 Aug 2021 12:10:37 +0200 Subject: [PATCH] osbuild2: make inputs generic for copy stage ctor Add a level of indirection for the copy stage constructor function in order to be able to use it with existing input types, like the files input. Co-Developed-by: Achilleas Koutsou Co-Developed-by: Antonio Murdaca --- internal/osbuild2/copy_stage.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/internal/osbuild2/copy_stage.go b/internal/osbuild2/copy_stage.go index 43a26ca10..5827699df 100644 --- a/internal/osbuild2/copy_stage.go +++ b/internal/osbuild2/copy_stage.go @@ -25,13 +25,23 @@ func (CopyStageInputs) isStageInputs() {} type CopyStageReferences []string +type CopyStageInputsNew interface { + isCopyStageInputs() +} + +func (CopyStageInputs) isCopyStageInputs() {} + func (CopyStageReferences) isReferences() {} -func NewCopyStage(options *CopyStageOptions, inputs *CopyStageInputs, devices *Devices, mounts *Mounts) *Stage { +func NewCopyStage(options *CopyStageOptions, inputs CopyStageInputsNew, devices *Devices, mounts *Mounts) *Stage { + var stageInputs Inputs + if inputs != nil { + stageInputs = inputs.(Inputs) + } return &Stage{ Type: "org.osbuild.copy", Options: options, - Inputs: inputs, + Inputs: stageInputs, Devices: *devices, Mounts: *mounts, }