osbuild: rework Ignition stage inputs
Rework the stage to not reimplement `FilesInput` as `IgnitionStageInput`, but instead use the one common `FilesInput` implementation and its supported references. Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
parent
645956d203
commit
b25e4bfa8b
1 changed files with 5 additions and 15 deletions
|
|
@ -18,24 +18,14 @@ func NewIgnitionStage(options *IgnitionStageOptions) *Stage {
|
|||
}
|
||||
|
||||
type IgnitionStageInputInline struct {
|
||||
InlineFile IgnitionStageInput `json:"inlinefile"`
|
||||
InlineFile *FilesInput `json:"inlinefile"`
|
||||
}
|
||||
|
||||
func (IgnitionStageInputInline) isStageInputs() {}
|
||||
|
||||
type IgnitionStageInput struct {
|
||||
inputCommon
|
||||
References IgnitionStageReferences `json:"references"`
|
||||
}
|
||||
|
||||
type IgnitionStageReferences []string
|
||||
|
||||
func (IgnitionStageReferences) isReferences() {}
|
||||
|
||||
func NewIgnitionInlineInput(embeddedData string) Inputs {
|
||||
inputs := new(IgnitionStageInputInline)
|
||||
inputs.InlineFile.Type = "org.osbuild.files"
|
||||
inputs.InlineFile.Origin = "org.osbuild.source"
|
||||
inputs.InlineFile.References = IgnitionStageReferences{fmt.Sprintf("sha256:%x", sha256.Sum256([]byte(embeddedData)))}
|
||||
return inputs
|
||||
input := NewFilesInput(NewFilesInputSourcePlainRef([]string{
|
||||
fmt.Sprintf("%x", sha256.Sum256([]byte(embeddedData))),
|
||||
}))
|
||||
return &IgnitionStageInputInline{InlineFile: input}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue