From b31d6ef6ac075c903ea11c89cc1d5156015b01a5 Mon Sep 17 00:00:00 2001 From: Jonathan Brill Date: Mon, 20 Nov 2023 18:17:16 -0500 Subject: [PATCH] DEVPROD-1661 add mountpoints to the distro mutation (#7256) --- graphql/generated.go | 45 +++++-------------- graphql/schema/types/distro.graphql | 3 +- graphql/tests/mutation/saveDistro/data.json | 3 ++ .../queries/insufficient_permissions.graphql | 1 + .../mutation/saveDistro/queries/save.graphql | 1 + .../queries/validation_error.graphql | 2 +- 6 files changed, 19 insertions(+), 36 deletions(-) diff --git a/graphql/generated.go b/graphql/generated.go index a6ff09f4ac7..5f8307dcdc0 100644 --- a/graphql/generated.go +++ b/graphql/generated.go @@ -17258,14 +17258,11 @@ func (ec *executionContext) _Distro_mountpoints(ctx context.Context, field graph return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } res := resTmp.([]string) fc.Result = res - return ec.marshalNString2ᚕstring(ctx, field.Selections, res) + return ec.marshalOString2ᚕstring(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Distro_mountpoints(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -66483,7 +66480,7 @@ func (ec *executionContext) unmarshalInputDistroInput(ctx context.Context, obj i asMap[k] = v } - fieldsInOrder := [...]string{"aliases", "arch", "authorizedKeysFile", "bootstrapSettings", "cloneMethod", "containerPool", "disabled", "disableShallowClone", "dispatcherSettings", "expansions", "finderSettings", "homeVolumeSettings", "hostAllocatorSettings", "iceCreamSettings", "isCluster", "isVirtualWorkStation", "name", "note", "plannerSettings", "provider", "providerSettingsList", "setup", "setupAsSudo", "sshKey", "sshOptions", "user", "userSpawnAllowed", "validProjects", "workDir"} + fieldsInOrder := [...]string{"aliases", "arch", "authorizedKeysFile", "bootstrapSettings", "cloneMethod", "containerPool", "disabled", "disableShallowClone", "dispatcherSettings", "expansions", "finderSettings", "homeVolumeSettings", "hostAllocatorSettings", "iceCreamSettings", "isCluster", "isVirtualWorkStation", "name", "note", "plannerSettings", "provider", "providerSettingsList", "setup", "setupAsSudo", "sshKey", "sshOptions", "user", "userSpawnAllowed", "validProjects", "workDir", "mountpoints"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -66778,6 +66775,15 @@ func (ec *executionContext) unmarshalInputDistroInput(ctx context.Context, obj i return it, err } it.WorkDir = data + case "mountpoints": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("mountpoints")) + data, err := ec.unmarshalOString2ᚕstring(ctx, v) + if err != nil { + return it, err + } + it.Mountpoints = data } } @@ -72633,9 +72639,6 @@ func (ec *executionContext) _Distro(ctx context.Context, sel ast.SelectionSet, o } case "mountpoints": out.Values[i] = ec._Distro_mountpoints(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -88546,32 +88549,6 @@ func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.S return res } -func (ec *executionContext) unmarshalNString2ᚕstring(ctx context.Context, v interface{}) ([]string, error) { - var vSlice []interface{} - if v != nil { - vSlice = graphql.CoerceList(v) - } - var err error - res := make([]string, len(vSlice)) - for i := range vSlice { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) - res[i], err = ec.unmarshalOString2string(ctx, vSlice[i]) - if err != nil { - return nil, err - } - } - return res, nil -} - -func (ec *executionContext) marshalNString2ᚕstring(ctx context.Context, sel ast.SelectionSet, v []string) graphql.Marshaler { - ret := make(graphql.Array, len(v)) - for i := range v { - ret[i] = ec.marshalOString2string(ctx, sel, v[i]) - } - - return ret -} - func (ec *executionContext) unmarshalNString2ᚕstringᚄ(ctx context.Context, v interface{}) ([]string, error) { var vSlice []interface{} if v != nil { diff --git a/graphql/schema/types/distro.graphql b/graphql/schema/types/distro.graphql index f79c976b302..98c34b73b6d 100644 --- a/graphql/schema/types/distro.graphql +++ b/graphql/schema/types/distro.graphql @@ -157,6 +157,7 @@ input DistroInput { userSpawnAllowed: Boolean! validProjects: [String!]! workDir: String! + mountpoints: [String] } input BootstrapSettingsInput { @@ -306,7 +307,7 @@ type Distro { userSpawnAllowed: Boolean! validProjects: [String]! workDir: String! - mountpoints: [String]! + mountpoints: [String] } type BootstrapSettings { diff --git a/graphql/tests/mutation/saveDistro/data.json b/graphql/tests/mutation/saveDistro/data.json index 514557e95f5..42ea3755696 100644 --- a/graphql/tests/mutation/saveDistro/data.json +++ b/graphql/tests/mutation/saveDistro/data.json @@ -9,6 +9,7 @@ "arch": "linux_ppc64le", "disabled": false, "work_dir": "/data/mci", + "mountpoints": ["/"], "provider": "static", "provider_settings": [ { @@ -118,6 +119,7 @@ ], "arch": "linux_ppc64le", "work_dir": "/data/mci", + "mountpoints": ["/"], "provider": "static", "provider_settings": [ { @@ -220,6 +222,7 @@ ], "arch": "linux_ppc64le", "work_dir": "/data/mci", + "mountpoints": ["/"], "provider": "static", "provider_settings": [ { diff --git a/graphql/tests/mutation/saveDistro/queries/insufficient_permissions.graphql b/graphql/tests/mutation/saveDistro/queries/insufficient_permissions.graphql index ed3d75b83bb..bc0b0a75757 100644 --- a/graphql/tests/mutation/saveDistro/queries/insufficient_permissions.graphql +++ b/graphql/tests/mutation/saveDistro/queries/insufficient_permissions.graphql @@ -11,6 +11,7 @@ mutation { authorizedKeysFile: "", containerPool: "", workDir: "/data/mci", + mountpoints: ["/"], disabled: true, provider: EC2_ON_DEMAND, providerSettingsList: [ diff --git a/graphql/tests/mutation/saveDistro/queries/save.graphql b/graphql/tests/mutation/saveDistro/queries/save.graphql index c90011a486e..55768668a52 100644 --- a/graphql/tests/mutation/saveDistro/queries/save.graphql +++ b/graphql/tests/mutation/saveDistro/queries/save.graphql @@ -11,6 +11,7 @@ mutation { containerPool: "", disabled: true, workDir: "/data/mci", + mountpoints: ["/"], provider: EC2_ON_DEMAND, providerSettingsList: [ { diff --git a/graphql/tests/mutation/saveDistro/queries/validation_error.graphql b/graphql/tests/mutation/saveDistro/queries/validation_error.graphql index db4438825f7..810e0b837a6 100644 --- a/graphql/tests/mutation/saveDistro/queries/validation_error.graphql +++ b/graphql/tests/mutation/saveDistro/queries/validation_error.graphql @@ -4,7 +4,7 @@ mutation { distro: { name: "rhel71-power8-large" workDir: "", - + mountpoints: ["/"], aliases: [ "new-alias" ],