osbuild2: change systemd-logind stage to match osbuild v30

The `org.osbuild.systemd-logind` stage was reworked before the osbuild
v30 release. Update the composer implementation to match the expected
schema.

Related to https://github.com/osbuild/osbuild/pull/739.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
This commit is contained in:
Tomas Hozza 2021-07-26 15:19:13 +02:00 committed by Tomas Hozza
parent 6cd626d462
commit 49aebf1c68
3 changed files with 14 additions and 21 deletions

View file

@ -467,30 +467,19 @@ func TestStage_UnmarshalJSON(t *testing.T) {
},
{
name: "systemd-logind",
fields: fields{
Type: "org.osbuild.systemd-logind",
Options: &SystemdLogindStageOptions{},
},
args: args{
data: []byte(`{"type":"org.osbuild.systemd-logind","options":{}}`),
},
},
{
name: "systemd-logind-data",
fields: fields{
Type: "org.osbuild.systemd-logind",
Options: &SystemdLogindStageOptions{
ConfigDropins: map[string]SystemdLogindConfigDropin{
"10-ec2-getty-fix.conf": {
Login: SystemdLogindConfigLoginSection{
NAutoVT: common.IntToPtr(0),
},
Filename: "10-ec2-getty-fix.conf",
Config: SystemdLogindConfigDropin{
Login: SystemdLogindConfigLoginSection{
NAutoVT: common.IntToPtr(0),
},
},
},
},
args: args{
data: []byte(`{"type":"org.osbuild.systemd-logind","options":{"configuration_dropins":{"10-ec2-getty-fix.conf":{"Login":{"NAutoVT":0}}}}}`),
data: []byte(`{"type":"org.osbuild.systemd-logind","options":{"filename":"10-ec2-getty-fix.conf","config":{"Login":{"NAutoVT":0}}}}`),
},
},
{

View file

@ -6,7 +6,8 @@ import (
)
type SystemdLogindStageOptions struct {
ConfigDropins map[string]SystemdLogindConfigDropin `json:"configuration_dropins,omitempty"`
Filename string `json:"filename"`
Config SystemdLogindConfigDropin `json:"config"`
}
func (SystemdLogindStageOptions) isStageOptions() {}

View file

@ -21,13 +21,16 @@ func TestSystemdLogindStage_MarshalJSON_Invalid(t *testing.T) {
name string
options SystemdLogindStageOptions
}{
{
name: "empty-options",
options: SystemdLogindStageOptions{},
},
{
name: "no-section-options",
options: SystemdLogindStageOptions{
ConfigDropins: map[string]SystemdLogindConfigDropin{
"10-ec2-getty-fix.conf": {
Login: SystemdLogindConfigLoginSection{},
},
Filename: "10-ec2-getty-fix.conf",
Config: SystemdLogindConfigDropin{
Login: SystemdLogindConfigLoginSection{},
},
},
},