diff --git a/go.mod b/go.mod index 9ed5eea0345..e939c853ea8 100644 --- a/go.mod +++ b/go.mod @@ -20,7 +20,7 @@ require ( github.com/coreos/go-oidc v2.2.1+incompatible github.com/coreos/go-semver v0.3.0 github.com/coreos/go-systemd/v22 v22.5.0 - github.com/coreos/ignition/v2 v2.7.0 + github.com/coreos/ignition/v2 v2.14.0 github.com/davecgh/go-spew v1.1.1 github.com/form3tech-oss/jwt-go v3.2.5+incompatible github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32 diff --git a/go.sum b/go.sum index d4684cc6993..802ca108b26 100644 --- a/go.sum +++ b/go.sum @@ -101,7 +101,6 @@ github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d h1:licZJFw2RwpH github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d/go.mod h1:asat636LX7Bqt5lYEZ27JNDcqxfjdBQuJ/MM4CN/Lzo= github.com/adrg/xdg v0.4.0/go.mod h1:N6ag73EX4wyxeaoeHctc1mas01KZgsj5tYiAIwqJE/E= github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c= -github.com/ajeddeloh/go-json v0.0.0-20170920214419-6a2fe990e083/go.mod h1:otnto4/Icqn88WCcM4bhIJNSgsh9VLBuspyyCfvof9c= github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= github.com/akavel/rsrc v0.8.0/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkKq+c= github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7/go.mod h1:6zEj6s6u/ghQa61ZWa/C2Aw3RkjiTBOix7dkqa1VLIs= @@ -136,6 +135,7 @@ github.com/aws/aws-sdk-go v1.17.7/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.30.28/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0= github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= +github.com/beevik/etree v1.1.1-0.20200718192613-4a2f8b9d084c/go.mod h1:0yGO2rna3S9DkITDWHY1bMtcY4IJ4w+4S+EooZUR0bE= github.com/benbjohnson/clock v1.0.3/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/benjamintf1/unmarshalledmatchers v1.0.0/go.mod h1:IVZdtAzpNyBTuhobduAjo5CjTLczWWbiXnWDVxIgSko= @@ -276,6 +276,7 @@ github.com/containers/storage v1.45.3 h1:GbtTvTtp3GW2/tcFg5VhgHXcYMwVn2KfZKiHjf9 github.com/containers/storage v1.45.3/go.mod h1:OdRUYHrq1HP6iAo79VxqtYuJzC5j4eA2I60jKOoCT7g= github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-iptables v0.6.0/go.mod h1:Qe8Bv2Xik5FyTXwgIbLAnv2sWSBmvWdFETJConOQ//Q= +github.com/coreos/go-json v0.0.0-20211020211907-c63f628265de/go.mod h1:lryFBkhadOfv8Jue2Vr/f/Yviw8h1DQPQojbXqEChY0= github.com/coreos/go-oidc v2.1.0+incompatible/go.mod h1:CgnwVTmzoESiwO9qyAFEMiHoZ1nMCKZlZ9V6mm3/LKc= github.com/coreos/go-oidc v2.2.1+incompatible h1:mh48q/BqXqgjVHpy2ZY7WnWAbenxRjsz9N1i1YxjHAk= github.com/coreos/go-oidc v2.2.1+incompatible/go.mod h1:CgnwVTmzoESiwO9qyAFEMiHoZ1nMCKZlZ9V6mm3/LKc= @@ -287,10 +288,10 @@ github.com/coreos/go-systemd/v22 v22.1.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+ github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -github.com/coreos/ignition/v2 v2.7.0 h1:JCKxJllVtnk1lQY1uisxrtFSHG5L2NI1LRzc8wBEk84= -github.com/coreos/ignition/v2 v2.7.0/go.mod h1:3CjaRpg51hmJzPjarbzB0RvSZbLkNOczxKJobTl6nOY= +github.com/coreos/ignition/v2 v2.14.0 h1:KfkCCnA6AK0kts/1zxzzNH5lDMCQN9sqqGcGs+RJVX4= +github.com/coreos/ignition/v2 v2.14.0/go.mod h1:wxc4qdYEIHLygzWbVVEuoD7lQGTZmMgX0VjAPYBbeEQ= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/coreos/vcontext v0.0.0-20190529201340-22b159166068/go.mod h1:E+6hug9bFSe0KZ2ZAzr8M9F5JlArJjv5D1JS7KSkPKE= +github.com/coreos/vcontext v0.0.0-20211021162308-f1dbbca7bef4/go.mod h1:HckqHnP/HI41vS0bfVjJ20u6jD0biI5+68QwZm5Xb9U= github.com/coreos/vcontext v0.0.0-20230201181013-d72178a18687 h1:uSmlDgJGbUB0bwQBcZomBTottKwEDF5fF8UjSwKSzWM= github.com/coreos/vcontext v0.0.0-20230201181013-d72178a18687/go.mod h1:Salmysdw7DAVuobBW/LwsKKgpyCPHUhjyJoMJD+ZJiI= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= @@ -768,7 +769,6 @@ github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/ github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= @@ -1228,7 +1228,6 @@ github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/goconvey v0.0.0-20190222223459-a17d461953aa/go.mod h1:2RVY1rIf+2J2o/IM9+vPq9RzmHDSseB7FoXiSNIUsoU= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/soheilhy/cmux v0.1.5/go.mod h1:T7TcVDs9LWfQgPlPsdngu6I6QIoyIFZDDC6sNE1GqG0= @@ -1313,7 +1312,6 @@ github.com/vbatts/tar-split v0.11.2 h1:Via6XqJr0hceW4wff3QRzD5gAk/tatMw/4ZA7cTlI github.com/vbatts/tar-split v0.11.2/go.mod h1:vV3ZuO2yWSVsz+pfFzDG/upWH1JhjOiEaWq6kXyQ3VI= github.com/vbauerster/mpb/v7 v7.5.3 h1:BkGfmb6nMrrBQDFECR/Q7RkKCw7ylMetCb4079CGs4w= github.com/vbauerster/mpb/v7 v7.5.3/go.mod h1:i+h4QY6lmLvBNK2ah1fSreiw3ajskRlBp9AhY/PnuOE= -github.com/vincent-petithory/dataurl v0.0.0-20160330182126-9a301d65acbb/go.mod h1:FHafX5vmDzyP+1CQATJn7WFKc9CvnvxyvZy6I1MrG/U= github.com/vincent-petithory/dataurl v1.0.0 h1:cXw+kPto8NLuJtlMsI152irrVw9fRDX8AbShPRpg2CI= github.com/vincent-petithory/dataurl v1.0.0/go.mod h1:FHafX5vmDzyP+1CQATJn7WFKc9CvnvxyvZy6I1MrG/U= github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYppBueQtXaqoE= @@ -1326,7 +1324,7 @@ github.com/vmihailenco/msgpack/v5 v5.3.5 h1:5gO0H1iULLWGhs2H5tbAHIZTV8/cYafcFOr9 github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= github.com/vmware/govmomi v0.22.2/go.mod h1:Y+Wq4lst78L85Ge/F8+ORXIWiKYqaro1vhAulACy9Lc= github.com/vmware/vmw-guestinfo v0.0.0-20170707015358-25eff159a728/go.mod h1:x9oS4Wk2s2u4tS29nEaDLdzvuHdB19CvSGJjPgkZJNk= -github.com/vmware/vmw-ovflib v0.0.0-20170608004843-1f217b9dc714/go.mod h1:jiPk45kn7klhByRvUq5i2vo1RtHKBHj+iWGFpxbXuuI= +github.com/vmware/vmw-guestinfo v0.0.0-20220317130741-510905f0efa3/go.mod h1:CSBTxrhePCm0cmXNKDGeu+6bOQzpaEklfCqEpn89JWk= github.com/weppos/publicsuffix-go v0.4.0/go.mod h1:z3LCPQ38eedDQSwmsSRW4Y7t2L8Ln16JPQ02lHAdn5k= github.com/weppos/publicsuffix-go v0.13.0/go.mod h1:z3LCPQ38eedDQSwmsSRW4Y7t2L8Ln16JPQ02lHAdn5k= github.com/xanzy/go-gitlab v0.15.0/go.mod h1:8zdQa/ri1dfn8eS3Ir1SyfvOKlw7WBJ8DVThkpGiXrs= @@ -1884,7 +1882,6 @@ gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20190502103701-55513cacd4ae/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/vendor/github.com/coreos/ignition/v2/config/shared/errors/errors.go b/vendor/github.com/coreos/ignition/v2/config/shared/errors/errors.go index 577ddf9359c..492fd7e6cfc 100644 --- a/vendor/github.com/coreos/ignition/v2/config/shared/errors/errors.go +++ b/vendor/github.com/coreos/ignition/v2/config/shared/errors/errors.go @@ -37,6 +37,7 @@ var ( ErrFileUsedSymlink = errors.New("file path includes link in config") ErrDirectoryUsedSymlink = errors.New("directory path includes link in config") ErrLinkUsedSymlink = errors.New("link path includes link in config") + ErrLinkTargetRequired = errors.New("link target is required") ErrHardLinkToDirectory = errors.New("hard link target is a directory") ErrDiskDeviceRequired = errors.New("disk device is required") ErrPartitionNumbersCollide = errors.New("partition numbers collide") @@ -46,7 +47,7 @@ var ( ErrVerificationAndNilSource = errors.New("source must be specified if verification is specified") ErrFilesystemInvalidFormat = errors.New("invalid filesystem format") ErrLabelNeedsFormat = errors.New("filesystem must specify format if label is specified") - ErrFormatNilWithOthers = errors.New("format cannot be empty when path, label, uuid, or options are specified") + ErrFormatNilWithOthers = errors.New("format cannot be empty when path, label, uuid, wipeFilesystem, options, or mountOptions is specified") ErrExt4LabelTooLong = errors.New("filesystem labels cannot be longer than 16 characters when using ext4") ErrBtrfsLabelTooLong = errors.New("filesystem labels cannot be longer than 256 characters when using btrfs") ErrXfsLabelTooLong = errors.New("filesystem labels cannot be longer than 12 characters when using xfs") @@ -55,11 +56,13 @@ var ( ErrLuksLabelTooLong = errors.New("luks device labels cannot be longer than 47 characters") ErrLuksNameContainsSlash = errors.New("device names cannot contain slashes") ErrInvalidLuksKeyFile = errors.New("invalid key-file source") + ErrClevisPinRequired = errors.New("missing required custom clevis pin") ErrUnknownClevisPin = errors.New("unsupported clevis pin") ErrClevisConfigRequired = errors.New("missing required custom clevis config") ErrClevisCustomWithOthers = errors.New("cannot use custom clevis config with tpm2, tang, or threshold") ErrTangThumbprintRequired = errors.New("thumbprint is required") ErrFileIllegalMode = errors.New("illegal file mode") + ErrModeSpecialBits = errors.New("setuid/setgid/sticky bits are not supported in spec versions older than 3.4.0") ErrBothIDAndNameSet = errors.New("cannot set both id and name") ErrLabelTooLong = errors.New("partition labels may not exceed 36 characters") ErrDoesntMatchGUIDRegex = errors.New("doesn't match the form \"01234567-89AB-CDEF-EDCB-A98765432101\"") @@ -67,8 +70,10 @@ var ( ErrNoPath = errors.New("path not specified") ErrPathRelative = errors.New("path not absolute") ErrDirtyPath = errors.New("path is not fully simplified") - ErrSparesUnsupportedForLevel = errors.New("spares unsupported for arrays with a level greater than 0") + ErrRaidLevelRequired = errors.New("raid level is required") + ErrSparesUnsupportedForLevel = errors.New("spares unsupported for linear and raid0 arrays") ErrUnrecognizedRaidLevel = errors.New("unrecognized raid level") + ErrRaidDevicesRequired = errors.New("raid devices required") ErrShouldNotExistWithOthers = errors.New("shouldExist specified false with other options also specified") ErrZeroesWithShouldNotExist = errors.New("shouldExist is false for a partition and other partition(s) has start or size 0") ErrNeedLabelOrNumber = errors.New("a partition number >= 1 or a label must be specified") @@ -95,6 +100,7 @@ var ( ErrEngineConfiguration = errors.New("engine incorrectly configured") // AWS S3 specific errors + ErrInvalidS3ARN = errors.New("invalid S3 ARN format") ErrInvalidS3ObjectVersionId = errors.New("invalid S3 object VersionId") // Obsolete errors, left here for ABI compatibility diff --git a/vendor/github.com/coreos/ignition/v2/config/util/config.go b/vendor/github.com/coreos/ignition/v2/config/util/config.go new file mode 100644 index 00000000000..85cd7fa7c4b --- /dev/null +++ b/vendor/github.com/coreos/ignition/v2/config/util/config.go @@ -0,0 +1,45 @@ +// Copyright 2021 Red Hat, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package util + +import ( + "github.com/coreos/ignition/v2/config/shared/errors" + + "github.com/coreos/go-semver/semver" + "github.com/coreos/vcontext/report" +) + +type versionStub struct { + Ignition struct { + Version string + } +} + +// GetConfigVersion parses the version from the given raw config +func GetConfigVersion(raw []byte) (semver.Version, report.Report, error) { + if len(raw) == 0 { + return semver.Version{}, report.Report{}, errors.ErrEmpty + } + + stub := versionStub{} + if rpt, err := HandleParseErrors(raw, &stub); err != nil { + return semver.Version{}, rpt, err + } + + version, err := semver.NewVersion(stub.Ignition.Version) + if err != nil { + return semver.Version{}, report.Report{}, errors.ErrInvalidVersion + } + return *version, report.Report{}, nil +} diff --git a/vendor/github.com/coreos/ignition/v2/config/util/helpers.go b/vendor/github.com/coreos/ignition/v2/config/util/helpers.go index 9c8b04413f2..9be42800b92 100644 --- a/vendor/github.com/coreos/ignition/v2/config/util/helpers.go +++ b/vendor/github.com/coreos/ignition/v2/config/util/helpers.go @@ -33,3 +33,11 @@ func NilOrEmpty(s *string) bool { func NotEmpty(s *string) bool { return s != nil && *s != "" } + +func IsTrue(b *bool) bool { + return b != nil && *b +} + +func IsFalse(b *bool) bool { + return b != nil && !*b +} diff --git a/vendor/github.com/coreos/ignition/v2/config/util/parsingErrors.go b/vendor/github.com/coreos/ignition/v2/config/util/parsingErrors.go index e55d9684977..2af85e2bc5b 100644 --- a/vendor/github.com/coreos/ignition/v2/config/util/parsingErrors.go +++ b/vendor/github.com/coreos/ignition/v2/config/util/parsingErrors.go @@ -16,7 +16,6 @@ package util import ( "encoding/json" - "fmt" "github.com/coreos/ignition/v2/config/shared/errors" @@ -42,7 +41,6 @@ func HandleParseErrors(rawConfig []byte, to interface{}) (report.Report, error) node.Marker = tree.MarkerFromIndices(t.Offset, -1) } tree.FixLineColumn(node, rawConfig) - fmt.Printf("%+v\n", node.Marker.StartP.Index) r.AddOnError(path.ContextPath{Tag: "json"}, err) r.Correlate(node) diff --git a/vendor/github.com/coreos/ignition/v2/config/util/reflection.go b/vendor/github.com/coreos/ignition/v2/config/util/reflection.go index 561a8706bad..51df4e124db 100644 --- a/vendor/github.com/coreos/ignition/v2/config/util/reflection.go +++ b/vendor/github.com/coreos/ignition/v2/config/util/reflection.go @@ -15,6 +15,7 @@ package util import ( + "fmt" "reflect" ) @@ -53,3 +54,38 @@ func IsInvalidInConfig(k reflect.Kind) bool { return true } } + +// Return a fully non-zero value for the specified type, recursively +// setting all fields and slices. +func NonZeroValue(t reflect.Type) reflect.Value { + v := reflect.New(t).Elem() + setNonZero(v) + return v +} + +func setNonZero(v reflect.Value) { + switch v.Kind() { + case reflect.Bool: + v.SetBool(true) + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + v.SetInt(1) + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + v.SetUint(1) + case reflect.Float32, reflect.Float64: + v.SetFloat(1) + case reflect.String: + v.SetString("aardvark") + case reflect.Ptr: + v.Set(reflect.New(v.Type().Elem())) + setNonZero(v.Elem()) + case reflect.Slice: + v.Set(reflect.MakeSlice(v.Type(), 1, 1)) + setNonZero(v.Index(0)) + case reflect.Struct: + for i := 0; i < v.NumField(); i++ { + setNonZero(v.Field(i)) + } + default: + panic(fmt.Sprintf("unexpected kind %s", v.Kind())) + } +} diff --git a/vendor/github.com/coreos/ignition/v2/config/v3_2/types/custom.go b/vendor/github.com/coreos/ignition/v2/config/v3_2/types/custom.go index 1b0c77b8b1d..2a1231cb34a 100644 --- a/vendor/github.com/coreos/ignition/v2/config/v3_2/types/custom.go +++ b/vendor/github.com/coreos/ignition/v2/config/v3_2/types/custom.go @@ -21,10 +21,6 @@ import ( "github.com/coreos/vcontext/report" ) -func (cu Custom) Key() string { - return cu.Pin -} - func (cu Custom) Validate(c path.ContextPath) (r report.Report) { if cu.Pin == "" && cu.Config == "" { return diff --git a/vendor/github.com/coreos/ignition/v2/config/v3_2/types/directory.go b/vendor/github.com/coreos/ignition/v2/config/v3_2/types/directory.go index f6f0684557c..b01a6bf9d75 100644 --- a/vendor/github.com/coreos/ignition/v2/config/v3_2/types/directory.go +++ b/vendor/github.com/coreos/ignition/v2/config/v3_2/types/directory.go @@ -22,5 +22,6 @@ import ( func (d Directory) Validate(c path.ContextPath) (r report.Report) { r.Merge(d.Node.Validate(c)) r.AddOnError(c.Append("mode"), validateMode(d.Mode)) + r.AddOnWarn(c.Append("mode"), validateModeSpecialBits(d.Mode)) return } diff --git a/vendor/github.com/coreos/ignition/v2/config/v3_2/types/disk.go b/vendor/github.com/coreos/ignition/v2/config/v3_2/types/disk.go index 17856e07a67..8caf8499d7b 100644 --- a/vendor/github.com/coreos/ignition/v2/config/v3_2/types/disk.go +++ b/vendor/github.com/coreos/ignition/v2/config/v3_2/types/disk.go @@ -16,6 +16,7 @@ package types import ( "github.com/coreos/ignition/v2/config/shared/errors" + "github.com/coreos/ignition/v2/config/util" "github.com/coreos/vcontext/path" "github.com/coreos/vcontext/report" @@ -127,7 +128,7 @@ func (n Disk) partitionsMixZeroesAndNonexistence() bool { hasZero := false hasShouldNotExist := false for _, p := range n.Partitions { - hasShouldNotExist = hasShouldNotExist || (p.ShouldExist != nil && !*p.ShouldExist) + hasShouldNotExist = hasShouldNotExist || util.IsFalse(p.ShouldExist) hasZero = hasZero || (p.Number == 0) } return hasZero && hasShouldNotExist diff --git a/vendor/github.com/coreos/ignition/v2/config/v3_2/types/file.go b/vendor/github.com/coreos/ignition/v2/config/v3_2/types/file.go index 04b14288d93..4e7566bd3b1 100644 --- a/vendor/github.com/coreos/ignition/v2/config/v3_2/types/file.go +++ b/vendor/github.com/coreos/ignition/v2/config/v3_2/types/file.go @@ -16,6 +16,7 @@ package types import ( "github.com/coreos/ignition/v2/config/shared/errors" + "github.com/coreos/ignition/v2/config/util" "github.com/coreos/vcontext/path" "github.com/coreos/vcontext/report" @@ -24,12 +25,13 @@ import ( func (f File) Validate(c path.ContextPath) (r report.Report) { r.Merge(f.Node.Validate(c)) r.AddOnError(c.Append("mode"), validateMode(f.Mode)) + r.AddOnWarn(c.Append("mode"), validateModeSpecialBits(f.Mode)) r.AddOnError(c.Append("overwrite"), f.validateOverwrite()) return } func (f File) validateOverwrite() error { - if f.Overwrite != nil && *f.Overwrite && f.Contents.Source == nil { + if util.IsTrue(f.Overwrite) && f.Contents.Source == nil { return errors.ErrOverwriteAndNilSource } return nil diff --git a/vendor/github.com/coreos/ignition/v2/config/v3_2/types/filesystem.go b/vendor/github.com/coreos/ignition/v2/config/v3_2/types/filesystem.go index 486aea86acf..3bf064f3556 100644 --- a/vendor/github.com/coreos/ignition/v2/config/v3_2/types/filesystem.go +++ b/vendor/github.com/coreos/ignition/v2/config/v3_2/types/filesystem.go @@ -50,6 +50,8 @@ func (f Filesystem) validateFormat() error { if util.NotEmpty(f.Path) || util.NotEmpty(f.Label) || util.NotEmpty(f.UUID) || + util.IsTrue(f.WipeFilesystem) || + len(f.MountOptions) != 0 || len(f.Options) != 0 { return errors.ErrFormatNilWithOthers } diff --git a/vendor/github.com/coreos/ignition/v2/config/v3_2/types/luks.go b/vendor/github.com/coreos/ignition/v2/config/v3_2/types/luks.go index d7cd29bac28..123392b25d4 100644 --- a/vendor/github.com/coreos/ignition/v2/config/v3_2/types/luks.go +++ b/vendor/github.com/coreos/ignition/v2/config/v3_2/types/luks.go @@ -46,7 +46,7 @@ func (l Luks) Validate(c path.ContextPath) (r report.Report) { } if l.Clevis != nil { - if l.Clevis.Custom != nil && (len(l.Clevis.Tang) > 0 || (l.Clevis.Tpm2 != nil && *l.Clevis.Tpm2) || (l.Clevis.Threshold != nil && *l.Clevis.Threshold != 0)) { + if l.Clevis.Custom != nil && (len(l.Clevis.Tang) > 0 || util.IsTrue(l.Clevis.Tpm2) || (l.Clevis.Threshold != nil && *l.Clevis.Threshold != 0)) { r.AddOnError(c.Append("clevis"), errors.ErrClevisCustomWithOthers) } } diff --git a/vendor/github.com/coreos/ignition/v2/config/v3_2/types/mode.go b/vendor/github.com/coreos/ignition/v2/config/v3_2/types/mode.go index 9eb7573d8ba..ad3e51c22ce 100644 --- a/vendor/github.com/coreos/ignition/v2/config/v3_2/types/mode.go +++ b/vendor/github.com/coreos/ignition/v2/config/v3_2/types/mode.go @@ -24,3 +24,13 @@ func validateMode(m *int) error { } return nil } + +func validateModeSpecialBits(m *int) error { + if m != nil { + mode := uint32(*m) + if mode&07000 != 0 { + return errors.ErrModeSpecialBits + } + } + return nil +} diff --git a/vendor/github.com/coreos/ignition/v2/config/v3_2/types/node.go b/vendor/github.com/coreos/ignition/v2/config/v3_2/types/node.go index 52576a924ae..248276e7378 100644 --- a/vendor/github.com/coreos/ignition/v2/config/v3_2/types/node.go +++ b/vendor/github.com/coreos/ignition/v2/config/v3_2/types/node.go @@ -18,6 +18,7 @@ import ( "path" "github.com/coreos/ignition/v2/config/shared/errors" + "github.com/coreos/ignition/v2/config/util" vpath "github.com/coreos/vcontext/path" "github.com/coreos/vcontext/report" @@ -41,7 +42,7 @@ func (n Node) Depth() int { } func validateIDorName(id *int, name *string) error { - if id != nil && (name != nil && *name != "") { + if id != nil && util.NotEmpty(name) { return errors.ErrBothIDAndNameSet } return nil diff --git a/vendor/github.com/coreos/ignition/v2/config/v3_2/types/partition.go b/vendor/github.com/coreos/ignition/v2/config/v3_2/types/partition.go index 4bb60b2b815..1b2d97edf12 100644 --- a/vendor/github.com/coreos/ignition/v2/config/v3_2/types/partition.go +++ b/vendor/github.com/coreos/ignition/v2/config/v3_2/types/partition.go @@ -20,6 +20,7 @@ import ( "strings" "github.com/coreos/ignition/v2/config/shared/errors" + "github.com/coreos/ignition/v2/config/util" "github.com/coreos/vcontext/path" "github.com/coreos/vcontext/report" @@ -36,14 +37,16 @@ var ( func (p Partition) Key() string { if p.Number != 0 { return fmt.Sprintf("number:%d", p.Number) - } else { + } else if p.Label != nil { return fmt.Sprintf("label:%s", *p.Label) + } else { + return "" } } func (p Partition) Validate(c path.ContextPath) (r report.Report) { - if p.ShouldExist != nil && !*p.ShouldExist && - (p.Label != nil || (p.TypeGUID != nil && *p.TypeGUID != "") || (p.GUID != nil && *p.GUID != "") || p.StartMiB != nil || p.SizeMiB != nil) { + if util.IsFalse(p.ShouldExist) && + (p.Label != nil || util.NotEmpty(p.TypeGUID) || util.NotEmpty(p.GUID) || p.StartMiB != nil || p.SizeMiB != nil) { r.AddOnError(c, errors.ErrShouldNotExistWithOthers) } if p.Number == 0 && p.Label == nil { diff --git a/vendor/github.com/coreos/ignition/v2/config/v3_2/types/raid.go b/vendor/github.com/coreos/ignition/v2/config/v3_2/types/raid.go index 039e54e6668..5ae4f8c099a 100644 --- a/vendor/github.com/coreos/ignition/v2/config/v3_2/types/raid.go +++ b/vendor/github.com/coreos/ignition/v2/config/v3_2/types/raid.go @@ -33,6 +33,9 @@ func (r Raid) IgnoreDuplicates() map[string]struct{} { func (ra Raid) Validate(c path.ContextPath) (r report.Report) { r.AddOnError(c.Append("level"), ra.validateLevel()) + if len(ra.Devices) == 0 { + r.AddOnError(c.Append("devices"), errors.ErrRaidDevicesRequired) + } return } diff --git a/vendor/github.com/coreos/ignition/v2/config/v3_2/types/storage.go b/vendor/github.com/coreos/ignition/v2/config/v3_2/types/storage.go index db7e44acd46..fd1b8cecf62 100644 --- a/vendor/github.com/coreos/ignition/v2/config/v3_2/types/storage.go +++ b/vendor/github.com/coreos/ignition/v2/config/v3_2/types/storage.go @@ -19,6 +19,7 @@ import ( "strings" "github.com/coreos/ignition/v2/config/shared/errors" + "github.com/coreos/ignition/v2/config/util" vpath "github.com/coreos/vcontext/path" "github.com/coreos/vcontext/report" @@ -53,7 +54,7 @@ func (s Storage) Validate(c vpath.ContextPath) (r report.Report) { r.AddOnError(c.Append("links", i), errors.ErrLinkUsedSymlink) } } - if l1.Hard == nil || !*l1.Hard { + if !util.IsTrue(l1.Hard) { continue } target := path.Clean(l1.Target) diff --git a/vendor/github.com/coreos/ignition/v2/config/v3_2/types/unit.go b/vendor/github.com/coreos/ignition/v2/config/v3_2/types/unit.go index 8d1a5f00ff9..bc2d3299c4b 100644 --- a/vendor/github.com/coreos/ignition/v2/config/v3_2/types/unit.go +++ b/vendor/github.com/coreos/ignition/v2/config/v3_2/types/unit.go @@ -21,6 +21,7 @@ import ( "github.com/coreos/ignition/v2/config/shared/errors" "github.com/coreos/ignition/v2/config/shared/validations" + "github.com/coreos/ignition/v2/config/util" "github.com/coreos/go-systemd/v22/unit" cpath "github.com/coreos/vcontext/path" @@ -41,8 +42,7 @@ func (u Unit) Validate(c cpath.ContextPath) (r report.Report) { opts, err := validateUnitContent(u.Contents) r.AddOnError(c, err) - isEnabled := u.Enabled != nil && *u.Enabled - r.AddOnWarn(c, validations.ValidateInstallSection(u.Name, isEnabled, (u.Contents == nil || *u.Contents == ""), opts)) + r.AddOnWarn(c, validations.ValidateInstallSection(u.Name, util.IsTrue(u.Enabled), util.NilOrEmpty(u.Contents), opts)) return } diff --git a/vendor/modules.txt b/vendor/modules.txt index 058619502a4..998d77e7312 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -415,8 +415,8 @@ github.com/coreos/go-systemd/v22/internal/dlopen github.com/coreos/go-systemd/v22/journal github.com/coreos/go-systemd/v22/sdjournal github.com/coreos/go-systemd/v22/unit -# github.com/coreos/ignition/v2 v2.7.0 -## explicit; go 1.11 +# github.com/coreos/ignition/v2 v2.14.0 +## explicit; go 1.15 github.com/coreos/ignition/v2/config/shared/errors github.com/coreos/ignition/v2/config/shared/validations github.com/coreos/ignition/v2/config/util