osbuild2: fix typo in systemd-logind stage

Signed-off-by: Tomas Hozza <thozza@redhat.com>
This commit is contained in:
Tomas Hozza 2021-07-27 15:56:15 +02:00 committed by Ondřej Budai
parent 0a71054d86
commit 241c5cc9d6
2 changed files with 4 additions and 4 deletions

View file

@ -471,13 +471,13 @@ func TestStage_UnmarshalJSON(t *testing.T) {
Filename: "10-ec2-getty-fix.conf",
Config: SystemdLogindConfigDropin{
Login: SystemdLogindConfigLoginSection{
NAutoVT: common.IntToPtr(0),
NAutoVTs: common.IntToPtr(0),
},
},
},
},
args: args{
data: []byte(`{"type":"org.osbuild.systemd-logind","options":{"filename":"10-ec2-getty-fix.conf","config":{"Login":{"NAutoVT":0}}}}`),
data: []byte(`{"type":"org.osbuild.systemd-logind","options":{"filename":"10-ec2-getty-fix.conf","config":{"Login":{"NAutoVTs":0}}}}`),
},
},
{

View file

@ -28,14 +28,14 @@ type SystemdLogindConfigDropin struct {
type SystemdLogindConfigLoginSection struct {
// Configures how many virtual terminals (VTs) to allocate by default
// The option is optional, but zero is a valid value
NAutoVT *int `json:"NAutoVT,omitempty"`
NAutoVTs *int `json:"NAutoVTs,omitempty"`
}
// Unexported alias for use in SystemdLogindConfigLoginSection's MarshalJSON() to prevent recursion
type systemdLogindConfigLoginSection SystemdLogindConfigLoginSection
func (s SystemdLogindConfigLoginSection) MarshalJSON() ([]byte, error) {
if s.NAutoVT == nil {
if s.NAutoVTs == nil {
return nil, fmt.Errorf("at least one 'Login' section option must be specified")
}
loginSection := systemdLogindConfigLoginSection(s)