osbuild2: new stage authconfig
This stage was introduced in osbuild 41. Add support into osbuild-composer.
This commit is contained in:
parent
85df63ce52
commit
59be127daf
4 changed files with 41 additions and 0 deletions
13
internal/osbuild2/authconfig_stage.go
Normal file
13
internal/osbuild2/authconfig_stage.go
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
package osbuild2
|
||||
|
||||
type AuthconfigStageOptions struct {
|
||||
}
|
||||
|
||||
func (AuthconfigStageOptions) isStageOptions() {}
|
||||
|
||||
func NewAuthconfigStage(options *AuthconfigStageOptions) *Stage {
|
||||
return &Stage{
|
||||
Type: "org.osbuild.authconfig",
|
||||
Options: options,
|
||||
}
|
||||
}
|
||||
16
internal/osbuild2/authconfig_stage_test.go
Normal file
16
internal/osbuild2/authconfig_stage_test.go
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
package osbuild2
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestNewAuthconfigStage(t *testing.T) {
|
||||
expectedStage := &Stage{
|
||||
Type: "org.osbuild.authconfig",
|
||||
Options: &AuthconfigStageOptions{},
|
||||
}
|
||||
actualStage := NewAuthconfigStage(&AuthconfigStageOptions{})
|
||||
assert.Equal(t, expectedStage, actualStage)
|
||||
}
|
||||
|
|
@ -148,6 +148,8 @@ func (stage *Stage) UnmarshalJSON(data []byte) error {
|
|||
inputs = new(FilesInputs)
|
||||
case "org.osbuild.sshd.config":
|
||||
options = new(SshdConfigStageOptions)
|
||||
case "org.osbuild.authconfig":
|
||||
options = new(AuthconfigStageOptions)
|
||||
default:
|
||||
return fmt.Errorf("unexpected stage type: %s", rawStage.Type)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -647,6 +647,16 @@ func TestStage_UnmarshalJSON(t *testing.T) {
|
|||
data: []byte(`{"type":"org.osbuild.sshd.config","options":{"config":{}}}`),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "authconfig",
|
||||
fields: fields{
|
||||
Type: "org.osbuild.authconfig",
|
||||
Options: &AuthconfigStageOptions{},
|
||||
},
|
||||
args: args{
|
||||
data: []byte(`{"type":"org.osbuild.authconfig","options":{}}`),
|
||||
},
|
||||
},
|
||||
}
|
||||
for idx, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue