├── .copr └── Makefile ├── .fmf └── version ├── .gitattributes ├── .github ├── ISSUE_TEMPLATE │ ├── release-checklist.md │ └── stabilize-checklist.md ├── dependabot.yml └── workflows │ ├── container-rebuild.yml │ ├── container.yml │ ├── go.yml │ └── require-release-note.yml ├── .gitignore ├── .golangci.yml ├── Dockerfile ├── LICENSE ├── NEWS.md ├── README.md ├── base ├── util │ ├── file.go │ ├── file_test.go │ ├── merge.go │ ├── merge_test.go │ ├── test.go │ └── url.go ├── v0_1 │ ├── schema.go │ ├── translate.go │ ├── translate_test.go │ ├── validate.go │ └── validate_test.go ├── v0_2 │ ├── schema.go │ ├── translate.go │ ├── translate_test.go │ ├── util.go │ ├── validate.go │ └── validate_test.go ├── v0_3 │ ├── schema.go │ ├── translate.go │ ├── translate_test.go │ ├── util.go │ ├── validate.go │ └── validate_test.go ├── v0_4 │ ├── schema.go │ ├── translate.go │ ├── translate_test.go │ ├── util.go │ ├── validate.go │ └── validate_test.go ├── v0_5 │ ├── schema.go │ ├── translate.go │ ├── translate_test.go │ ├── util.go │ ├── validate.go │ └── validate_test.go ├── v0_6 │ ├── schema.go │ ├── translate.go │ ├── translate_test.go │ ├── util.go │ ├── validate.go │ └── validate_test.go └── v0_7_exp │ ├── schema.go │ ├── translate.go │ ├── translate_test.go │ ├── util.go │ ├── validate.go │ └── validate_test.go ├── build ├── build_for_container ├── config ├── common │ ├── common.go │ └── errors.go ├── config.go ├── fcos │ ├── v1_0 │ │ ├── schema.go │ │ ├── translate.go │ │ ├── translate_test.go │ │ └── validate_test.go │ ├── v1_1 │ │ ├── schema.go │ │ ├── translate.go │ │ ├── translate_test.go │ │ └── validate_test.go │ ├── v1_2 │ │ ├── schema.go │ │ ├── translate.go │ │ ├── translate_test.go │ │ └── validate_test.go │ ├── v1_3 │ │ ├── schema.go │ │ ├── translate.go │ │ ├── translate_test.go │ │ ├── validate.go │ │ └── validate_test.go │ ├── v1_4 │ │ ├── schema.go │ │ ├── translate.go │ │ ├── translate_test.go │ │ ├── validate.go │ │ └── validate_test.go │ ├── v1_5 │ │ ├── schema.go │ │ ├── translate.go │ │ ├── translate_test.go │ │ ├── validate.go │ │ └── validate_test.go │ ├── v1_6 │ │ ├── schema.go │ │ ├── translate.go │ │ ├── translate_test.go │ │ ├── validate.go │ │ └── validate_test.go │ └── v1_7_exp │ │ ├── schema.go │ │ ├── translate.go │ │ ├── translate_test.go │ │ ├── validate.go │ │ └── validate_test.go ├── fiot │ ├── v1_0 │ │ ├── schema.go │ │ ├── translate.go │ │ └── translate_test.go │ └── v1_1_exp │ │ ├── schema.go │ │ ├── translate.go │ │ └── translate_test.go ├── flatcar │ ├── v1_0 │ │ ├── schema.go │ │ ├── translate.go │ │ └── translate_test.go │ ├── v1_1 │ │ ├── schema.go │ │ ├── translate.go │ │ └── translate_test.go │ └── v1_2_exp │ │ ├── schema.go │ │ ├── translate.go │ │ └── translate_test.go ├── openshift │ ├── v4_10 │ │ ├── result │ │ │ └── schema.go │ │ ├── schema.go │ │ ├── translate.go │ │ ├── translate_test.go │ │ ├── validate.go │ │ └── validate_test.go │ ├── v4_11 │ │ ├── result │ │ │ └── schema.go │ │ ├── schema.go │ │ ├── translate.go │ │ ├── translate_test.go │ │ ├── validate.go │ │ └── validate_test.go │ ├── v4_12 │ │ ├── result │ │ │ └── schema.go │ │ ├── schema.go │ │ ├── translate.go │ │ ├── translate_test.go │ │ ├── validate.go │ │ └── validate_test.go │ ├── v4_13 │ │ ├── result │ │ │ └── schema.go │ │ ├── schema.go │ │ ├── translate.go │ │ ├── translate_test.go │ │ ├── validate.go │ │ └── validate_test.go │ ├── v4_14 │ │ ├── result │ │ │ └── schema.go │ │ ├── schema.go │ │ ├── translate.go │ │ ├── translate_test.go │ │ ├── validate.go │ │ └── validate_test.go │ ├── v4_15 │ │ ├── result │ │ │ └── schema.go │ │ ├── schema.go │ │ ├── translate.go │ │ ├── translate_test.go │ │ ├── validate.go │ │ └── validate_test.go │ ├── v4_16 │ │ ├── result │ │ │ └── schema.go │ │ ├── schema.go │ │ ├── translate.go │ │ ├── translate_test.go │ │ ├── validate.go │ │ └── validate_test.go │ ├── v4_17 │ │ ├── result │ │ │ └── schema.go │ │ ├── schema.go │ │ ├── translate.go │ │ ├── translate_test.go │ │ ├── validate.go │ │ └── validate_test.go │ ├── v4_18 │ │ ├── result │ │ │ └── schema.go │ │ ├── schema.go │ │ ├── translate.go │ │ ├── translate_test.go │ │ ├── validate.go │ │ └── validate_test.go │ ├── v4_19 │ │ ├── result │ │ │ └── schema.go │ │ ├── schema.go │ │ ├── translate.go │ │ ├── translate_test.go │ │ ├── validate.go │ │ └── validate_test.go │ ├── v4_20_exp │ │ ├── result │ │ │ └── schema.go │ │ ├── schema.go │ │ ├── translate.go │ │ ├── translate_test.go │ │ ├── validate.go │ │ └── validate_test.go │ ├── v4_8 │ │ ├── result │ │ │ └── schema.go │ │ ├── schema.go │ │ ├── translate.go │ │ ├── translate_test.go │ │ ├── validate.go │ │ └── validate_test.go │ └── v4_9 │ │ ├── result │ │ └── schema.go │ │ ├── schema.go │ │ ├── translate.go │ │ ├── translate_test.go │ │ ├── validate.go │ │ └── validate_test.go ├── r4e │ ├── v1_0 │ │ ├── schema.go │ │ ├── translate.go │ │ └── translate_test.go │ ├── v1_1 │ │ ├── schema.go │ │ ├── translate.go │ │ └── translate_test.go │ └── v1_2_exp │ │ ├── schema.go │ │ ├── translate.go │ │ └── translate_test.go └── util │ ├── filter.go │ ├── filter_test.go │ ├── util.go │ └── util_test.go ├── docs ├── _config.yml ├── _sass │ ├── color_schemes │ │ └── coreos.scss │ └── custom │ │ └── custom.scss ├── config-fcos-v1_0.md ├── config-fcos-v1_1.md ├── config-fcos-v1_2.md ├── config-fcos-v1_3.md ├── config-fcos-v1_4.md ├── config-fcos-v1_5.md ├── config-fcos-v1_6.md ├── config-fcos-v1_7-exp.md ├── config-fiot-v1_0.md ├── config-fiot-v1_1-exp.md ├── config-flatcar-v1_0.md ├── config-flatcar-v1_1.md ├── config-flatcar-v1_2-exp.md ├── config-openshift-v4_10.md ├── config-openshift-v4_11.md ├── config-openshift-v4_12.md ├── config-openshift-v4_13.md ├── config-openshift-v4_14.md ├── config-openshift-v4_15.md ├── config-openshift-v4_16.md ├── config-openshift-v4_17.md ├── config-openshift-v4_18.md ├── config-openshift-v4_19.md ├── config-openshift-v4_20-exp.md ├── config-openshift-v4_8.md ├── config-openshift-v4_9.md ├── config-r4e-v1_0.md ├── config-r4e-v1_1.md ├── config-r4e-v1_2-exp.md ├── development.md ├── examples.md ├── favicon.ico ├── getting-started.md ├── index.md ├── release-notes.md ├── specs.md ├── upgrading-fcos.md ├── upgrading-flatcar.md ├── upgrading-openshift.md ├── upgrading-r4e.md └── upgrading.md ├── generate ├── go.mod ├── go.sum ├── internal ├── doc │ ├── butane.yaml │ ├── header.md │ └── main.go ├── main.go └── version │ └── version.go ├── plans └── smoke.fmf ├── signing-ticket.sh ├── tag_release.sh ├── test ├── tests ├── main.fmf └── smoke │ ├── main.fmf │ └── test.sh ├── translate ├── set.go ├── set_test.go ├── tests │ ├── pkga │ │ └── types.go │ ├── pkgb │ │ └── types.go │ └── readme.txt ├── translate.go ├── translate_test.go └── util.go └── vendor ├── github.com ├── aws │ └── aws-sdk-go │ │ ├── LICENSE.txt │ │ ├── NOTICE.txt │ │ └── aws │ │ └── arn │ │ └── arn.go ├── clarketm │ └── json │ │ ├── LICENSE │ │ ├── README.md │ │ ├── decode.go │ │ ├── encode.go │ │ ├── fold.go │ │ ├── fuzz.go │ │ ├── indent.go │ │ ├── scanner.go │ │ ├── stream.go │ │ ├── tables.go │ │ └── tags.go ├── coreos │ ├── go-json │ │ ├── LICENSE │ │ ├── PATENTS │ │ ├── README.md │ │ ├── decode.go │ │ ├── encode.go │ │ ├── fold.go │ │ ├── fuzz.go │ │ ├── indent.go │ │ ├── scanner.go │ │ ├── stream.go │ │ ├── tables.go │ │ └── tags.go │ ├── go-semver │ │ ├── LICENSE │ │ ├── NOTICE │ │ └── semver │ │ │ ├── semver.go │ │ │ └── sort.go │ ├── go-systemd │ │ └── v22 │ │ │ ├── LICENSE │ │ │ ├── NOTICE │ │ │ └── unit │ │ │ ├── deserialize.go │ │ │ ├── escape.go │ │ │ ├── option.go │ │ │ ├── section.go │ │ │ └── serialize.go │ ├── ignition │ │ └── v2 │ │ │ ├── LICENSE │ │ │ ├── NOTICE │ │ │ └── config │ │ │ ├── doc │ │ │ ├── generate.go │ │ │ ├── ignition.yaml │ │ │ └── schema.go │ │ │ ├── merge │ │ │ └── merge.go │ │ │ ├── shared │ │ │ ├── errors │ │ │ │ └── errors.go │ │ │ ├── parse │ │ │ │ └── unit.go │ │ │ └── validations │ │ │ │ └── unit.go │ │ │ ├── util │ │ │ ├── config.go │ │ │ ├── helpers.go │ │ │ ├── interfaces.go │ │ │ ├── parsingErrors.go │ │ │ └── reflection.go │ │ │ ├── v3_0 │ │ │ └── types │ │ │ │ ├── ca.go │ │ │ │ ├── config.go │ │ │ │ ├── device.go │ │ │ │ ├── directory.go │ │ │ │ ├── disk.go │ │ │ │ ├── file.go │ │ │ │ ├── filesystem.go │ │ │ │ ├── ignition.go │ │ │ │ ├── mode.go │ │ │ │ ├── node.go │ │ │ │ ├── partition.go │ │ │ │ ├── passwd.go │ │ │ │ ├── path.go │ │ │ │ ├── raid.go │ │ │ │ ├── schema.go │ │ │ │ ├── storage.go │ │ │ │ ├── systemd.go │ │ │ │ ├── unit.go │ │ │ │ ├── url.go │ │ │ │ └── verification.go │ │ │ ├── v3_1 │ │ │ └── types │ │ │ │ ├── config.go │ │ │ │ ├── device.go │ │ │ │ ├── directory.go │ │ │ │ ├── disk.go │ │ │ │ ├── file.go │ │ │ │ ├── filesystem.go │ │ │ │ ├── headers.go │ │ │ │ ├── ignition.go │ │ │ │ ├── mode.go │ │ │ │ ├── node.go │ │ │ │ ├── partition.go │ │ │ │ ├── passwd.go │ │ │ │ ├── path.go │ │ │ │ ├── proxy.go │ │ │ │ ├── raid.go │ │ │ │ ├── resource.go │ │ │ │ ├── schema.go │ │ │ │ ├── storage.go │ │ │ │ ├── systemd.go │ │ │ │ ├── tls.go │ │ │ │ ├── unit.go │ │ │ │ ├── url.go │ │ │ │ └── verification.go │ │ │ ├── v3_2 │ │ │ └── types │ │ │ │ ├── config.go │ │ │ │ ├── custom.go │ │ │ │ ├── device.go │ │ │ │ ├── directory.go │ │ │ │ ├── disk.go │ │ │ │ ├── file.go │ │ │ │ ├── filesystem.go │ │ │ │ ├── headers.go │ │ │ │ ├── ignition.go │ │ │ │ ├── luks.go │ │ │ │ ├── mode.go │ │ │ │ ├── node.go │ │ │ │ ├── partition.go │ │ │ │ ├── passwd.go │ │ │ │ ├── path.go │ │ │ │ ├── proxy.go │ │ │ │ ├── raid.go │ │ │ │ ├── resource.go │ │ │ │ ├── schema.go │ │ │ │ ├── storage.go │ │ │ │ ├── systemd.go │ │ │ │ ├── tang.go │ │ │ │ ├── tls.go │ │ │ │ ├── unit.go │ │ │ │ ├── url.go │ │ │ │ └── verification.go │ │ │ ├── v3_3 │ │ │ └── types │ │ │ │ ├── clevis.go │ │ │ │ ├── config.go │ │ │ │ ├── device.go │ │ │ │ ├── directory.go │ │ │ │ ├── disk.go │ │ │ │ ├── file.go │ │ │ │ ├── filesystem.go │ │ │ │ ├── headers.go │ │ │ │ ├── ignition.go │ │ │ │ ├── kargs.go │ │ │ │ ├── luks.go │ │ │ │ ├── mode.go │ │ │ │ ├── node.go │ │ │ │ ├── partition.go │ │ │ │ ├── passwd.go │ │ │ │ ├── path.go │ │ │ │ ├── proxy.go │ │ │ │ ├── raid.go │ │ │ │ ├── resource.go │ │ │ │ ├── schema.go │ │ │ │ ├── storage.go │ │ │ │ ├── systemd.go │ │ │ │ ├── tang.go │ │ │ │ ├── tls.go │ │ │ │ ├── unit.go │ │ │ │ ├── url.go │ │ │ │ └── verification.go │ │ │ ├── v3_4 │ │ │ └── types │ │ │ │ ├── clevis.go │ │ │ │ ├── config.go │ │ │ │ ├── device.go │ │ │ │ ├── directory.go │ │ │ │ ├── disk.go │ │ │ │ ├── file.go │ │ │ │ ├── filesystem.go │ │ │ │ ├── headers.go │ │ │ │ ├── ignition.go │ │ │ │ ├── kargs.go │ │ │ │ ├── luks.go │ │ │ │ ├── mode.go │ │ │ │ ├── node.go │ │ │ │ ├── partition.go │ │ │ │ ├── passwd.go │ │ │ │ ├── path.go │ │ │ │ ├── proxy.go │ │ │ │ ├── raid.go │ │ │ │ ├── resource.go │ │ │ │ ├── schema.go │ │ │ │ ├── storage.go │ │ │ │ ├── systemd.go │ │ │ │ ├── tang.go │ │ │ │ ├── tls.go │ │ │ │ ├── unit.go │ │ │ │ ├── url.go │ │ │ │ └── verification.go │ │ │ ├── v3_5 │ │ │ └── types │ │ │ │ ├── cex.go │ │ │ │ ├── clevis.go │ │ │ │ ├── config.go │ │ │ │ ├── device.go │ │ │ │ ├── directory.go │ │ │ │ ├── disk.go │ │ │ │ ├── file.go │ │ │ │ ├── filesystem.go │ │ │ │ ├── headers.go │ │ │ │ ├── ignition.go │ │ │ │ ├── kargs.go │ │ │ │ ├── luks.go │ │ │ │ ├── mode.go │ │ │ │ ├── node.go │ │ │ │ ├── partition.go │ │ │ │ ├── passwd.go │ │ │ │ ├── path.go │ │ │ │ ├── proxy.go │ │ │ │ ├── raid.go │ │ │ │ ├── resource.go │ │ │ │ ├── schema.go │ │ │ │ ├── storage.go │ │ │ │ ├── systemd.go │ │ │ │ ├── tang.go │ │ │ │ ├── tls.go │ │ │ │ ├── unit.go │ │ │ │ ├── url.go │ │ │ │ └── verification.go │ │ │ ├── v3_6_experimental │ │ │ └── types │ │ │ │ ├── cex.go │ │ │ │ ├── clevis.go │ │ │ │ ├── config.go │ │ │ │ ├── device.go │ │ │ │ ├── directory.go │ │ │ │ ├── disk.go │ │ │ │ ├── file.go │ │ │ │ ├── filesystem.go │ │ │ │ ├── headers.go │ │ │ │ ├── ignition.go │ │ │ │ ├── kargs.go │ │ │ │ ├── luks.go │ │ │ │ ├── mode.go │ │ │ │ ├── node.go │ │ │ │ ├── partition.go │ │ │ │ ├── passwd.go │ │ │ │ ├── path.go │ │ │ │ ├── proxy.go │ │ │ │ ├── raid.go │ │ │ │ ├── resource.go │ │ │ │ ├── schema.go │ │ │ │ ├── storage.go │ │ │ │ ├── systemd.go │ │ │ │ ├── tang.go │ │ │ │ ├── tls.go │ │ │ │ ├── unit.go │ │ │ │ ├── url.go │ │ │ │ └── verification.go │ │ │ └── validate │ │ │ └── validate.go │ └── vcontext │ │ ├── LICENSE │ │ ├── json │ │ └── json.go │ │ ├── path │ │ └── path.go │ │ ├── report │ │ └── report.go │ │ ├── tree │ │ └── tree.go │ │ ├── validate │ │ └── validate.go │ │ └── yaml │ │ └── yaml.go ├── davecgh │ └── go-spew │ │ ├── LICENSE │ │ └── spew │ │ ├── bypass.go │ │ ├── bypasssafe.go │ │ ├── common.go │ │ ├── config.go │ │ ├── doc.go │ │ ├── dump.go │ │ ├── format.go │ │ └── spew.go ├── mitchellh │ ├── copystructure │ │ ├── LICENSE │ │ ├── README.md │ │ ├── copier_time.go │ │ └── copystructure.go │ └── reflectwalk │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── README.md │ │ ├── location.go │ │ ├── location_string.go │ │ └── reflectwalk.go ├── pmezard │ └── go-difflib │ │ ├── LICENSE │ │ └── difflib │ │ └── difflib.go ├── spf13 │ └── pflag │ │ ├── .editorconfig │ │ ├── .gitignore │ │ ├── .golangci.yaml │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── README.md │ │ ├── bool.go │ │ ├── bool_slice.go │ │ ├── bytes.go │ │ ├── count.go │ │ ├── duration.go │ │ ├── duration_slice.go │ │ ├── flag.go │ │ ├── float32.go │ │ ├── float32_slice.go │ │ ├── float64.go │ │ ├── float64_slice.go │ │ ├── golangflag.go │ │ ├── int.go │ │ ├── int16.go │ │ ├── int32.go │ │ ├── int32_slice.go │ │ ├── int64.go │ │ ├── int64_slice.go │ │ ├── int8.go │ │ ├── int_slice.go │ │ ├── ip.go │ │ ├── ip_slice.go │ │ ├── ipmask.go │ │ ├── ipnet.go │ │ ├── ipnet_slice.go │ │ ├── string.go │ │ ├── string_array.go │ │ ├── string_slice.go │ │ ├── string_to_int.go │ │ ├── string_to_int64.go │ │ ├── string_to_string.go │ │ ├── uint.go │ │ ├── uint16.go │ │ ├── uint32.go │ │ ├── uint64.go │ │ ├── uint8.go │ │ └── uint_slice.go ├── stretchr │ └── testify │ │ ├── LICENSE │ │ └── assert │ │ ├── assertion_compare.go │ │ ├── assertion_format.go │ │ ├── assertion_format.go.tmpl │ │ ├── assertion_forward.go │ │ ├── assertion_forward.go.tmpl │ │ ├── assertion_order.go │ │ ├── assertions.go │ │ ├── doc.go │ │ ├── errors.go │ │ ├── forward_assertions.go │ │ ├── http_assertions.go │ │ └── yaml │ │ ├── yaml_custom.go │ │ ├── yaml_default.go │ │ └── yaml_fail.go └── vincent-petithory │ └── dataurl │ ├── LICENSE │ ├── README.md │ ├── dataurl.go │ ├── doc.go │ ├── lex.go │ ├── rfc2396.go │ └── wercker.yml ├── gopkg.in └── yaml.v3 │ ├── LICENSE │ ├── NOTICE │ ├── README.md │ ├── apic.go │ ├── decode.go │ ├── emitterc.go │ ├── encode.go │ ├── parserc.go │ ├── readerc.go │ ├── resolve.go │ ├── scannerc.go │ ├── sorter.go │ ├── writerc.go │ ├── yaml.go │ ├── yamlh.go │ └── yamlprivateh.go └── modules.txt /.copr/Makefile: -------------------------------------------------------------------------------- 1 | # Maintained in https://github.com/coreos/repo-templates 2 | # Do not edit downstream. 3 | 4 | .PHONY: srpm 5 | srpm: 6 | dnf install -y git rpm-build rpmdevtools 7 | # similar to https://github.com/actions/checkout/issues/760, but for COPR 8 | git config --global --add safe.directory '*' 9 | curl -LOf https://src.fedoraproject.org/rpms/butane/raw/rawhide/f/butane.spec 10 | version=$$(git describe --always --tags | sed -e 's,-,\.,g' -e 's,^v,,'); \ 11 | git archive --format=tar --prefix=butane-$$version/ HEAD | gzip > butane-$$version.tar.gz; \ 12 | sed -ie "s,^Version:.*,Version: $$version," butane.spec 13 | sed -ie 's/^Patch/# Patch/g' butane.spec # we don't want any downstream patches 14 | spectool -g butane.spec # download any remaining sources (e.g. coreos-installer-dracut) 15 | rpmbuild -bs --define "_sourcedir ${PWD}" --define "_specdir ${PWD}" --define "_builddir ${PWD}" --define "_srcrpmdir ${PWD}" --define "_rpmdir ${PWD}" --define "_buildrootdir ${PWD}/.build" butane.spec 16 | mv *.src.rpm $$outdir 17 | -------------------------------------------------------------------------------- /.fmf/version: -------------------------------------------------------------------------------- 1 | 1 2 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.go text eol=lf 2 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # Maintained in https://github.com/coreos/repo-templates 2 | # Do not edit downstream. 3 | 4 | version: 2 5 | updates: 6 | - package-ecosystem: "github-actions" 7 | directory: "/" 8 | schedule: 9 | interval: "weekly" 10 | labels: ["skip-notes"] 11 | open-pull-requests-limit: 3 12 | - package-ecosystem: gomod 13 | directory: / 14 | schedule: 15 | interval: weekly 16 | open-pull-requests-limit: 10 17 | labels: 18 | - dependency 19 | - skip-notes 20 | -------------------------------------------------------------------------------- /.github/workflows/container-rebuild.yml: -------------------------------------------------------------------------------- 1 | # Maintained in https://github.com/coreos/repo-templates 2 | # Do not edit downstream. 3 | 4 | name: Rebuild release container 5 | 6 | on: 7 | workflow_dispatch: 8 | inputs: 9 | git-tag: 10 | description: Existing Git tag 11 | default: vX.Y.Z 12 | docker-tag: 13 | description: New Docker versioned tag 14 | default: vX.Y.Z-1 15 | 16 | permissions: 17 | contents: read 18 | 19 | # avoid races when pushing containers built from main 20 | concurrency: 21 | group: ${{ github.workflow }}-${{ github.ref }} 22 | 23 | jobs: 24 | build-container: 25 | name: Build container image 26 | runs-on: ubuntu-latest 27 | steps: 28 | - name: Check out repository 29 | uses: actions/checkout@v4 30 | with: 31 | ref: ${{ github.event.inputs.git-tag }} 32 | # fetch tags so the compiled-in version number is useful 33 | fetch-depth: 0 34 | # If we're running on a signed tag, actions/checkout rewrites it into 35 | # a lightweight tag (!!!) which "git describe" then ignores. Rewrite 36 | # it back. 37 | # https://github.com/actions/checkout/issues/290 38 | - name: Fix actions/checkout synthetic tag 39 | run: git fetch --tags --force 40 | - name: Build and push container 41 | uses: coreos/actions-lib/build-container@main 42 | with: 43 | credentials: ${{ secrets.QUAY_AUTH }} 44 | push: quay.io/coreos/butane quay.io/coreos/fcct 45 | arches: amd64 arm64 46 | tags: ${{ github.event.inputs.docker-tag }} release 47 | -------------------------------------------------------------------------------- /.github/workflows/container.yml: -------------------------------------------------------------------------------- 1 | # Maintained in https://github.com/coreos/repo-templates 2 | # Do not edit downstream. 3 | 4 | name: Container 5 | 6 | on: 7 | push: 8 | branches: [main] 9 | tags: ["v*"] 10 | pull_request: 11 | branches: [main] 12 | 13 | permissions: 14 | contents: read 15 | 16 | # avoid races when pushing containers built from main 17 | concurrency: 18 | group: ${{ github.workflow }}-${{ github.ref }} 19 | 20 | jobs: 21 | build-container: 22 | name: Build container image 23 | runs-on: ubuntu-latest 24 | steps: 25 | - name: Check out repository 26 | uses: actions/checkout@v4 27 | with: 28 | # fetch tags so the compiled-in version number is useful 29 | fetch-depth: 0 30 | # If we're running on a signed tag, actions/checkout rewrites it into 31 | # a lightweight tag (!!!) which "git describe" then ignores. Rewrite 32 | # it back. 33 | # https://github.com/actions/checkout/issues/290 34 | - name: Fix actions/checkout synthetic tag 35 | run: git fetch --tags --force 36 | - name: Build and push container 37 | uses: coreos/actions-lib/build-container@main 38 | with: 39 | credentials: ${{ secrets.QUAY_AUTH }} 40 | push: quay.io/coreos/butane quay.io/coreos/fcct 41 | arches: amd64 arm64 42 | # Speed up PR CI by skipping non-amd64 43 | pr-arches: amd64 44 | -------------------------------------------------------------------------------- /.github/workflows/require-release-note.yml: -------------------------------------------------------------------------------- 1 | # Maintained in https://github.com/coreos/repo-templates 2 | # Do not edit downstream. 3 | 4 | name: Release notes 5 | 6 | on: 7 | pull_request: 8 | branches: [main] 9 | types: [opened, synchronize, reopened, labeled, unlabeled] 10 | 11 | permissions: 12 | contents: read 13 | 14 | concurrency: 15 | group: release-note-${{ github.ref }} 16 | cancel-in-progress: true 17 | 18 | jobs: 19 | require-notes: 20 | name: Require release note 21 | runs-on: ubuntu-latest 22 | steps: 23 | - name: Require release-notes.md update 24 | uses: coreos/actions-lib/require-file-change@main 25 | with: 26 | path: docs/release-notes.md 27 | override-label: skip-notes 28 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /bin 2 | /tmpdocs 3 | -------------------------------------------------------------------------------- /.golangci.yml: -------------------------------------------------------------------------------- 1 | issues: 2 | exclude-rules: 3 | # Allow unkeyed fields in composite literals in tests 4 | - path: _test\.go$ 5 | text: "composite literal uses unkeyed fields" 6 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM quay.io/fedora/fedora:42 AS builder 2 | RUN dnf install -y golang git-core 3 | RUN mkdir /butane 4 | COPY . /butane 5 | WORKDIR /butane 6 | RUN ./build_for_container 7 | 8 | FROM quay.io/fedora/fedora-minimal:42 9 | COPY --from=builder /butane/bin/container/butane /usr/local/bin/butane 10 | ENTRYPOINT ["/usr/local/bin/butane"] 11 | -------------------------------------------------------------------------------- /NEWS.md: -------------------------------------------------------------------------------- 1 | docs/release-notes.md -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Butane 2 | 3 | Butane (formerly the Fedora CoreOS Config Transpiler, FCCT) translates human readable Butane Configs 4 | into machine readable [Ignition](https://github.com/coreos/ignition) Configs. See the [getting 5 | started](docs/getting-started.md) guide for how to use Butane and the [configuration 6 | specifications](docs/specs.md) for everything Butane configs support. 7 | 8 | For information on developing Butane, using it as a library, or understanding how the binaries released 9 | in this repository are built, see the [development docs](docs/development.md). 10 | -------------------------------------------------------------------------------- /base/v0_1/validate.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Red Hat, Inc 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License.) 14 | 15 | package v0_1 16 | 17 | import ( 18 | baseutil "github.com/coreos/butane/base/util" 19 | "github.com/coreos/butane/config/common" 20 | 21 | "github.com/coreos/vcontext/path" 22 | "github.com/coreos/vcontext/report" 23 | ) 24 | 25 | func (f FileContents) Validate(c path.ContextPath) (r report.Report) { 26 | if f.Inline != nil && f.Source != nil { 27 | r.AddOnError(c.Append("inline"), common.ErrTooManyResourceSources) 28 | } 29 | return 30 | } 31 | 32 | func (d Directory) Validate(c path.ContextPath) (r report.Report) { 33 | if d.Mode != nil { 34 | r.AddOnWarn(c.Append("mode"), baseutil.CheckForDecimalMode(*d.Mode, true)) 35 | } 36 | return 37 | } 38 | 39 | func (f File) Validate(c path.ContextPath) (r report.Report) { 40 | if f.Mode != nil { 41 | r.AddOnWarn(c.Append("mode"), baseutil.CheckForDecimalMode(*f.Mode, false)) 42 | } 43 | return 44 | } 45 | -------------------------------------------------------------------------------- /build: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eu 4 | 5 | export GO111MODULE=on 6 | export GOFLAGS=-mod=vendor 7 | export CGO_ENABLED=0 8 | version=$(git describe --dirty --always) 9 | LDFLAGS="-w -X github.com/coreos/butane/internal/version.Raw=$version" 10 | 11 | NAME=butane 12 | 13 | if [ -z ${BIN_PATH+a} ]; then 14 | BIN_PATH=${PWD}/bin/$(go env GOARCH) 15 | fi 16 | 17 | echo "Building $NAME..." 18 | go build -o ${BIN_PATH}/${NAME} -ldflags "$LDFLAGS" internal/main.go 19 | -------------------------------------------------------------------------------- /build_for_container: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -euo pipefail 4 | 5 | export GO111MODULE=on 6 | export GOFLAGS=-mod=vendor 7 | export CGO_ENABLED=0 8 | version=$(git describe --dirty --always) 9 | LDFLAGS="-w -X github.com/coreos/butane/internal/version.Raw=$version" 10 | 11 | eval $(go env) 12 | if [ -z ${BIN_PATH+a} ]; then 13 | export BIN_PATH=${PWD}/bin/container/ 14 | fi 15 | 16 | export GOOS=linux 17 | go build -o ${BIN_PATH}/butane -ldflags "$LDFLAGS" internal/main.go 18 | -------------------------------------------------------------------------------- /config/common/common.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Red Hat, Inc 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License.) 14 | 15 | package common 16 | 17 | type TranslateOptions struct { 18 | FilesDir string // allow embedding local files relative to this directory 19 | NoResourceAutoCompression bool // skip automatic compression of inline/local resources 20 | DebugPrintTranslations bool // report translations to stderr 21 | } 22 | 23 | type TranslateBytesOptions struct { 24 | TranslateOptions 25 | Pretty bool 26 | Raw bool // encode only the Ignition config, not any wrapper 27 | } 28 | -------------------------------------------------------------------------------- /config/fcos/v1_0/schema.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License.) 14 | 15 | package v1_0 16 | 17 | import ( 18 | base "github.com/coreos/butane/base/v0_1" 19 | ) 20 | 21 | type Config struct { 22 | base.Config `yaml:",inline"` 23 | } 24 | -------------------------------------------------------------------------------- /config/fcos/v1_1/schema.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License.) 14 | 15 | package v1_1 16 | 17 | import ( 18 | base "github.com/coreos/butane/base/v0_2" 19 | ) 20 | 21 | type Config struct { 22 | base.Config `yaml:",inline"` 23 | } 24 | -------------------------------------------------------------------------------- /config/fcos/v1_2/schema.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License.) 14 | 15 | package v1_2 16 | 17 | import ( 18 | base "github.com/coreos/butane/base/v0_3" 19 | ) 20 | 21 | type Config struct { 22 | base.Config `yaml:",inline"` 23 | } 24 | -------------------------------------------------------------------------------- /config/fcos/v1_3/schema.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License.) 14 | 15 | package v1_3 16 | 17 | import ( 18 | base "github.com/coreos/butane/base/v0_3" 19 | ) 20 | 21 | type Config struct { 22 | base.Config `yaml:",inline"` 23 | BootDevice BootDevice `yaml:"boot_device"` 24 | } 25 | 26 | type BootDevice struct { 27 | Layout *string `yaml:"layout"` 28 | Luks BootDeviceLuks `yaml:"luks"` 29 | Mirror BootDeviceMirror `yaml:"mirror"` 30 | } 31 | 32 | type BootDeviceLuks struct { 33 | Tang []base.Tang `yaml:"tang"` 34 | Threshold *int `yaml:"threshold"` 35 | Tpm2 *bool `yaml:"tpm2"` 36 | } 37 | 38 | type BootDeviceMirror struct { 39 | Devices []string `yaml:"devices"` 40 | } 41 | -------------------------------------------------------------------------------- /config/fcos/v1_3/validate.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License.) 14 | 15 | package v1_3 16 | 17 | import ( 18 | "github.com/coreos/butane/config/common" 19 | 20 | "github.com/coreos/vcontext/path" 21 | "github.com/coreos/vcontext/report" 22 | ) 23 | 24 | func (d BootDevice) Validate(c path.ContextPath) (r report.Report) { 25 | if d.Layout != nil { 26 | switch *d.Layout { 27 | case "aarch64", "ppc64le", "x86_64": 28 | default: 29 | r.AddOnError(c.Append("layout"), common.ErrUnknownBootDeviceLayout) 30 | } 31 | } 32 | r.Merge(d.Mirror.Validate(c.Append("mirror"))) 33 | return 34 | } 35 | 36 | func (m BootDeviceMirror) Validate(c path.ContextPath) (r report.Report) { 37 | if len(m.Devices) == 1 { 38 | r.AddOnError(c.Append("devices"), common.ErrTooFewMirrorDevices) 39 | } 40 | return 41 | } 42 | -------------------------------------------------------------------------------- /config/fcos/v1_4/schema.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License.) 14 | 15 | package v1_4 16 | 17 | import ( 18 | base "github.com/coreos/butane/base/v0_4" 19 | ) 20 | 21 | type Config struct { 22 | base.Config `yaml:",inline"` 23 | BootDevice BootDevice `yaml:"boot_device"` 24 | } 25 | 26 | type BootDevice struct { 27 | Layout *string `yaml:"layout"` 28 | Luks BootDeviceLuks `yaml:"luks"` 29 | Mirror BootDeviceMirror `yaml:"mirror"` 30 | } 31 | 32 | type BootDeviceLuks struct { 33 | Tang []base.Tang `yaml:"tang"` 34 | Threshold *int `yaml:"threshold"` 35 | Tpm2 *bool `yaml:"tpm2"` 36 | } 37 | 38 | type BootDeviceMirror struct { 39 | Devices []string `yaml:"devices"` 40 | } 41 | -------------------------------------------------------------------------------- /config/fcos/v1_4/validate.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License.) 14 | 15 | package v1_4 16 | 17 | import ( 18 | "github.com/coreos/butane/config/common" 19 | 20 | "github.com/coreos/vcontext/path" 21 | "github.com/coreos/vcontext/report" 22 | ) 23 | 24 | func (d BootDevice) Validate(c path.ContextPath) (r report.Report) { 25 | if d.Layout != nil { 26 | switch *d.Layout { 27 | case "aarch64", "ppc64le", "x86_64": 28 | default: 29 | r.AddOnError(c.Append("layout"), common.ErrUnknownBootDeviceLayout) 30 | } 31 | } 32 | r.Merge(d.Mirror.Validate(c.Append("mirror"))) 33 | return 34 | } 35 | 36 | func (m BootDeviceMirror) Validate(c path.ContextPath) (r report.Report) { 37 | if len(m.Devices) == 1 { 38 | r.AddOnError(c.Append("devices"), common.ErrTooFewMirrorDevices) 39 | } 40 | return 41 | } 42 | -------------------------------------------------------------------------------- /config/fcos/v1_5/schema.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License.) 14 | 15 | package v1_5 16 | 17 | import ( 18 | base "github.com/coreos/butane/base/v0_5" 19 | ) 20 | 21 | type Config struct { 22 | base.Config `yaml:",inline"` 23 | BootDevice BootDevice `yaml:"boot_device"` 24 | Grub Grub `yaml:"grub"` 25 | } 26 | 27 | type BootDevice struct { 28 | Layout *string `yaml:"layout"` 29 | Luks BootDeviceLuks `yaml:"luks"` 30 | Mirror BootDeviceMirror `yaml:"mirror"` 31 | } 32 | 33 | type BootDeviceLuks struct { 34 | Discard *bool `yaml:"discard"` 35 | Tang []base.Tang `yaml:"tang"` 36 | Threshold *int `yaml:"threshold"` 37 | Tpm2 *bool `yaml:"tpm2"` 38 | } 39 | 40 | type BootDeviceMirror struct { 41 | Devices []string `yaml:"devices"` 42 | } 43 | 44 | type Grub struct { 45 | Users []GrubUser `yaml:"users"` 46 | } 47 | 48 | type GrubUser struct { 49 | Name string `yaml:"name"` 50 | PasswordHash *string `yaml:"password_hash"` 51 | } 52 | -------------------------------------------------------------------------------- /config/fcos/v1_6/schema.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License.) 14 | 15 | package v1_6 16 | 17 | import ( 18 | base "github.com/coreos/butane/base/v0_6" 19 | ) 20 | 21 | type Config struct { 22 | base.Config `yaml:",inline"` 23 | BootDevice BootDevice `yaml:"boot_device"` 24 | Grub Grub `yaml:"grub"` 25 | } 26 | 27 | type BootDevice struct { 28 | Layout *string `yaml:"layout"` 29 | Luks BootDeviceLuks `yaml:"luks"` 30 | Mirror BootDeviceMirror `yaml:"mirror"` 31 | } 32 | 33 | type BootDeviceLuks struct { 34 | Cex base.Cex `yaml:"cex"` 35 | Discard *bool `yaml:"discard"` 36 | Device *string `yaml:"device"` 37 | Tang []base.Tang `yaml:"tang"` 38 | Threshold *int `yaml:"threshold"` 39 | Tpm2 *bool `yaml:"tpm2"` 40 | } 41 | 42 | type BootDeviceMirror struct { 43 | Devices []string `yaml:"devices"` 44 | } 45 | 46 | type Grub struct { 47 | Users []GrubUser `yaml:"users"` 48 | } 49 | 50 | type GrubUser struct { 51 | Name string `yaml:"name"` 52 | PasswordHash *string `yaml:"password_hash"` 53 | } 54 | -------------------------------------------------------------------------------- /config/fcos/v1_7_exp/schema.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License.) 14 | 15 | package v1_7_exp 16 | 17 | import ( 18 | base "github.com/coreos/butane/base/v0_7_exp" 19 | ) 20 | 21 | type Config struct { 22 | base.Config `yaml:",inline"` 23 | BootDevice BootDevice `yaml:"boot_device"` 24 | Grub Grub `yaml:"grub"` 25 | } 26 | 27 | type BootDevice struct { 28 | Layout *string `yaml:"layout"` 29 | Luks BootDeviceLuks `yaml:"luks"` 30 | Mirror BootDeviceMirror `yaml:"mirror"` 31 | } 32 | 33 | type BootDeviceLuks struct { 34 | Cex base.Cex `yaml:"cex"` 35 | Discard *bool `yaml:"discard"` 36 | Device *string `yaml:"device"` 37 | Tang []base.Tang `yaml:"tang"` 38 | Threshold *int `yaml:"threshold"` 39 | Tpm2 *bool `yaml:"tpm2"` 40 | } 41 | 42 | type BootDeviceMirror struct { 43 | Devices []string `yaml:"devices"` 44 | } 45 | 46 | type Grub struct { 47 | Users []GrubUser `yaml:"users"` 48 | } 49 | 50 | type GrubUser struct { 51 | Name string `yaml:"name"` 52 | PasswordHash *string `yaml:"password_hash"` 53 | } 54 | -------------------------------------------------------------------------------- /config/fiot/v1_0/schema.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Red Hat, Inc 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License.) 14 | 15 | package v1_0 16 | 17 | import ( 18 | base "github.com/coreos/butane/base/v0_5" 19 | ) 20 | 21 | type Config struct { 22 | base.Config `yaml:",inline"` 23 | } 24 | -------------------------------------------------------------------------------- /config/fiot/v1_1_exp/schema.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Red Hat, Inc 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License.) 14 | 15 | package v1_1_exp 16 | 17 | import ( 18 | base "github.com/coreos/butane/base/v0_7_exp" 19 | ) 20 | 21 | type Config struct { 22 | base.Config `yaml:",inline"` 23 | } 24 | -------------------------------------------------------------------------------- /config/flatcar/v1_0/schema.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License.) 14 | 15 | package v1_0 16 | 17 | import ( 18 | base "github.com/coreos/butane/base/v0_4" 19 | ) 20 | 21 | type Config struct { 22 | base.Config `yaml:",inline"` 23 | } 24 | -------------------------------------------------------------------------------- /config/flatcar/v1_1/schema.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License.) 14 | 15 | package v1_1 16 | 17 | import ( 18 | base "github.com/coreos/butane/base/v0_5" 19 | ) 20 | 21 | type Config struct { 22 | base.Config `yaml:",inline"` 23 | } 24 | -------------------------------------------------------------------------------- /config/flatcar/v1_2_exp/schema.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License.) 14 | 15 | package v1_2_exp 16 | 17 | import ( 18 | base "github.com/coreos/butane/base/v0_7_exp" 19 | ) 20 | 21 | type Config struct { 22 | base.Config `yaml:",inline"` 23 | } 24 | -------------------------------------------------------------------------------- /config/openshift/v4_10/schema.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License.) 14 | 15 | package v4_10 16 | 17 | import ( 18 | fcos "github.com/coreos/butane/config/fcos/v1_3" 19 | ) 20 | 21 | const ROLE_LABEL_KEY = "machineconfiguration.openshift.io/role" 22 | 23 | type Config struct { 24 | fcos.Config `yaml:",inline"` 25 | Metadata Metadata `yaml:"metadata"` 26 | OpenShift OpenShift `yaml:"openshift"` 27 | } 28 | 29 | type Metadata struct { 30 | Name string `yaml:"name"` 31 | Labels map[string]string `yaml:"labels,omitempty"` 32 | } 33 | 34 | type OpenShift struct { 35 | KernelArguments []string `yaml:"kernel_arguments"` 36 | Extensions []string `yaml:"extensions"` 37 | FIPS *bool `yaml:"fips"` 38 | KernelType *string `yaml:"kernel_type"` 39 | } 40 | -------------------------------------------------------------------------------- /config/openshift/v4_10/validate.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Red Hat, Inc 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License.) 14 | 15 | package v4_10 16 | 17 | import ( 18 | "github.com/coreos/butane/config/common" 19 | 20 | "github.com/coreos/vcontext/path" 21 | "github.com/coreos/vcontext/report" 22 | ) 23 | 24 | func (m Metadata) Validate(c path.ContextPath) (r report.Report) { 25 | if m.Name == "" { 26 | r.AddOnError(c.Append("name"), common.ErrNameRequired) 27 | } 28 | if m.Labels[ROLE_LABEL_KEY] == "" { 29 | r.AddOnError(c.Append("labels"), common.ErrRoleRequired) 30 | } 31 | return 32 | } 33 | 34 | func (os OpenShift) Validate(c path.ContextPath) (r report.Report) { 35 | if os.KernelType != nil { 36 | switch *os.KernelType { 37 | case "", "default", "realtime": 38 | default: 39 | r.AddOnError(c.Append("kernel_type"), common.ErrInvalidKernelType) 40 | } 41 | } 42 | return 43 | } 44 | -------------------------------------------------------------------------------- /config/openshift/v4_11/schema.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License.) 14 | 15 | package v4_11 16 | 17 | import ( 18 | fcos "github.com/coreos/butane/config/fcos/v1_3" 19 | ) 20 | 21 | const ROLE_LABEL_KEY = "machineconfiguration.openshift.io/role" 22 | 23 | type Config struct { 24 | fcos.Config `yaml:",inline"` 25 | Metadata Metadata `yaml:"metadata"` 26 | OpenShift OpenShift `yaml:"openshift"` 27 | } 28 | 29 | type Metadata struct { 30 | Name string `yaml:"name"` 31 | Labels map[string]string `yaml:"labels,omitempty"` 32 | } 33 | 34 | type OpenShift struct { 35 | KernelArguments []string `yaml:"kernel_arguments"` 36 | Extensions []string `yaml:"extensions"` 37 | FIPS *bool `yaml:"fips"` 38 | KernelType *string `yaml:"kernel_type"` 39 | } 40 | -------------------------------------------------------------------------------- /config/openshift/v4_11/validate.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Red Hat, Inc 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License.) 14 | 15 | package v4_11 16 | 17 | import ( 18 | "github.com/coreos/butane/config/common" 19 | 20 | "github.com/coreos/vcontext/path" 21 | "github.com/coreos/vcontext/report" 22 | ) 23 | 24 | func (m Metadata) Validate(c path.ContextPath) (r report.Report) { 25 | if m.Name == "" { 26 | r.AddOnError(c.Append("name"), common.ErrNameRequired) 27 | } 28 | if m.Labels[ROLE_LABEL_KEY] == "" { 29 | r.AddOnError(c.Append("labels"), common.ErrRoleRequired) 30 | } 31 | return 32 | } 33 | 34 | func (os OpenShift) Validate(c path.ContextPath) (r report.Report) { 35 | if os.KernelType != nil { 36 | switch *os.KernelType { 37 | case "", "default", "realtime": 38 | default: 39 | r.AddOnError(c.Append("kernel_type"), common.ErrInvalidKernelType) 40 | } 41 | } 42 | return 43 | } 44 | -------------------------------------------------------------------------------- /config/openshift/v4_12/schema.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License.) 14 | 15 | package v4_12 16 | 17 | import ( 18 | fcos "github.com/coreos/butane/config/fcos/v1_3" 19 | ) 20 | 21 | const ROLE_LABEL_KEY = "machineconfiguration.openshift.io/role" 22 | 23 | type Config struct { 24 | fcos.Config `yaml:",inline"` 25 | Metadata Metadata `yaml:"metadata"` 26 | OpenShift OpenShift `yaml:"openshift"` 27 | } 28 | 29 | type Metadata struct { 30 | Name string `yaml:"name"` 31 | Labels map[string]string `yaml:"labels,omitempty"` 32 | } 33 | 34 | type OpenShift struct { 35 | KernelArguments []string `yaml:"kernel_arguments"` 36 | Extensions []string `yaml:"extensions"` 37 | FIPS *bool `yaml:"fips"` 38 | KernelType *string `yaml:"kernel_type"` 39 | } 40 | -------------------------------------------------------------------------------- /config/openshift/v4_12/validate.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Red Hat, Inc 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License.) 14 | 15 | package v4_12 16 | 17 | import ( 18 | "github.com/coreos/butane/config/common" 19 | 20 | "github.com/coreos/vcontext/path" 21 | "github.com/coreos/vcontext/report" 22 | ) 23 | 24 | func (m Metadata) Validate(c path.ContextPath) (r report.Report) { 25 | if m.Name == "" { 26 | r.AddOnError(c.Append("name"), common.ErrNameRequired) 27 | } 28 | if m.Labels[ROLE_LABEL_KEY] == "" { 29 | r.AddOnError(c.Append("labels"), common.ErrRoleRequired) 30 | } 31 | return 32 | } 33 | 34 | func (os OpenShift) Validate(c path.ContextPath) (r report.Report) { 35 | if os.KernelType != nil { 36 | switch *os.KernelType { 37 | case "", "default", "realtime": 38 | default: 39 | r.AddOnError(c.Append("kernel_type"), common.ErrInvalidKernelType) 40 | } 41 | } 42 | return 43 | } 44 | -------------------------------------------------------------------------------- /config/openshift/v4_13/schema.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License.) 14 | 15 | package v4_13 16 | 17 | import ( 18 | fcos "github.com/coreos/butane/config/fcos/v1_3" 19 | ) 20 | 21 | const ROLE_LABEL_KEY = "machineconfiguration.openshift.io/role" 22 | 23 | type Config struct { 24 | fcos.Config `yaml:",inline"` 25 | Metadata Metadata `yaml:"metadata"` 26 | OpenShift OpenShift `yaml:"openshift"` 27 | } 28 | 29 | type Metadata struct { 30 | Name string `yaml:"name"` 31 | Labels map[string]string `yaml:"labels,omitempty"` 32 | } 33 | 34 | type OpenShift struct { 35 | KernelArguments []string `yaml:"kernel_arguments"` 36 | Extensions []string `yaml:"extensions"` 37 | FIPS *bool `yaml:"fips"` 38 | KernelType *string `yaml:"kernel_type"` 39 | } 40 | -------------------------------------------------------------------------------- /config/openshift/v4_13/validate.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Red Hat, Inc 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License.) 14 | 15 | package v4_13 16 | 17 | import ( 18 | "github.com/coreos/butane/config/common" 19 | 20 | "github.com/coreos/vcontext/path" 21 | "github.com/coreos/vcontext/report" 22 | ) 23 | 24 | func (m Metadata) Validate(c path.ContextPath) (r report.Report) { 25 | if m.Name == "" { 26 | r.AddOnError(c.Append("name"), common.ErrNameRequired) 27 | } 28 | if m.Labels[ROLE_LABEL_KEY] == "" { 29 | r.AddOnError(c.Append("labels"), common.ErrRoleRequired) 30 | } 31 | return 32 | } 33 | 34 | func (os OpenShift) Validate(c path.ContextPath) (r report.Report) { 35 | if os.KernelType != nil { 36 | switch *os.KernelType { 37 | case "", "default", "realtime": 38 | default: 39 | r.AddOnError(c.Append("kernel_type"), common.ErrInvalidKernelType) 40 | } 41 | } 42 | return 43 | } 44 | -------------------------------------------------------------------------------- /config/openshift/v4_14/schema.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License.) 14 | 15 | package v4_14 16 | 17 | import ( 18 | fcos "github.com/coreos/butane/config/fcos/v1_5" 19 | ) 20 | 21 | const ROLE_LABEL_KEY = "machineconfiguration.openshift.io/role" 22 | 23 | type Config struct { 24 | fcos.Config `yaml:",inline"` 25 | Metadata Metadata `yaml:"metadata"` 26 | OpenShift OpenShift `yaml:"openshift"` 27 | } 28 | 29 | type Metadata struct { 30 | Name string `yaml:"name"` 31 | Labels map[string]string `yaml:"labels,omitempty"` 32 | } 33 | 34 | type OpenShift struct { 35 | KernelArguments []string `yaml:"kernel_arguments"` 36 | Extensions []string `yaml:"extensions"` 37 | FIPS *bool `yaml:"fips"` 38 | KernelType *string `yaml:"kernel_type"` 39 | } 40 | -------------------------------------------------------------------------------- /config/openshift/v4_14/validate.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Red Hat, Inc 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License.) 14 | 15 | package v4_14 16 | 17 | import ( 18 | "github.com/coreos/butane/config/common" 19 | 20 | "github.com/coreos/vcontext/path" 21 | "github.com/coreos/vcontext/report" 22 | ) 23 | 24 | func (m Metadata) Validate(c path.ContextPath) (r report.Report) { 25 | if m.Name == "" { 26 | r.AddOnError(c.Append("name"), common.ErrNameRequired) 27 | } 28 | if m.Labels[ROLE_LABEL_KEY] == "" { 29 | r.AddOnError(c.Append("labels"), common.ErrRoleRequired) 30 | } 31 | return 32 | } 33 | 34 | func (os OpenShift) Validate(c path.ContextPath) (r report.Report) { 35 | if os.KernelType != nil { 36 | switch *os.KernelType { 37 | case "", "default", "realtime": 38 | default: 39 | r.AddOnError(c.Append("kernel_type"), common.ErrInvalidKernelType) 40 | } 41 | } 42 | return 43 | } 44 | -------------------------------------------------------------------------------- /config/openshift/v4_15/schema.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License.) 14 | 15 | package v4_15 16 | 17 | import ( 18 | fcos "github.com/coreos/butane/config/fcos/v1_5" 19 | ) 20 | 21 | const ROLE_LABEL_KEY = "machineconfiguration.openshift.io/role" 22 | 23 | type Config struct { 24 | fcos.Config `yaml:",inline"` 25 | Metadata Metadata `yaml:"metadata"` 26 | OpenShift OpenShift `yaml:"openshift"` 27 | } 28 | 29 | type Metadata struct { 30 | Name string `yaml:"name"` 31 | Labels map[string]string `yaml:"labels,omitempty"` 32 | } 33 | 34 | type OpenShift struct { 35 | KernelArguments []string `yaml:"kernel_arguments"` 36 | Extensions []string `yaml:"extensions"` 37 | FIPS *bool `yaml:"fips"` 38 | KernelType *string `yaml:"kernel_type"` 39 | } 40 | -------------------------------------------------------------------------------- /config/openshift/v4_15/validate.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Red Hat, Inc 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License.) 14 | 15 | package v4_15 16 | 17 | import ( 18 | "github.com/coreos/butane/config/common" 19 | 20 | "github.com/coreos/vcontext/path" 21 | "github.com/coreos/vcontext/report" 22 | ) 23 | 24 | func (m Metadata) Validate(c path.ContextPath) (r report.Report) { 25 | if m.Name == "" { 26 | r.AddOnError(c.Append("name"), common.ErrNameRequired) 27 | } 28 | if m.Labels[ROLE_LABEL_KEY] == "" { 29 | r.AddOnError(c.Append("labels"), common.ErrRoleRequired) 30 | } 31 | return 32 | } 33 | 34 | func (os OpenShift) Validate(c path.ContextPath) (r report.Report) { 35 | if os.KernelType != nil { 36 | switch *os.KernelType { 37 | case "", "default", "realtime": 38 | default: 39 | r.AddOnError(c.Append("kernel_type"), common.ErrInvalidKernelType) 40 | } 41 | } 42 | return 43 | } 44 | -------------------------------------------------------------------------------- /config/openshift/v4_16/schema.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License.) 14 | 15 | package v4_16 16 | 17 | import ( 18 | fcos "github.com/coreos/butane/config/fcos/v1_5" 19 | ) 20 | 21 | const ROLE_LABEL_KEY = "machineconfiguration.openshift.io/role" 22 | 23 | type Config struct { 24 | fcos.Config `yaml:",inline"` 25 | Metadata Metadata `yaml:"metadata"` 26 | OpenShift OpenShift `yaml:"openshift"` 27 | } 28 | 29 | type Metadata struct { 30 | Name string `yaml:"name"` 31 | Labels map[string]string `yaml:"labels,omitempty"` 32 | } 33 | 34 | type OpenShift struct { 35 | KernelArguments []string `yaml:"kernel_arguments"` 36 | Extensions []string `yaml:"extensions"` 37 | FIPS *bool `yaml:"fips"` 38 | KernelType *string `yaml:"kernel_type"` 39 | } 40 | -------------------------------------------------------------------------------- /config/openshift/v4_16/validate.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Red Hat, Inc 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License.) 14 | 15 | package v4_16 16 | 17 | import ( 18 | "github.com/coreos/butane/config/common" 19 | 20 | "github.com/coreos/vcontext/path" 21 | "github.com/coreos/vcontext/report" 22 | ) 23 | 24 | func (m Metadata) Validate(c path.ContextPath) (r report.Report) { 25 | if m.Name == "" { 26 | r.AddOnError(c.Append("name"), common.ErrNameRequired) 27 | } 28 | if m.Labels[ROLE_LABEL_KEY] == "" { 29 | r.AddOnError(c.Append("labels"), common.ErrRoleRequired) 30 | } 31 | return 32 | } 33 | 34 | func (os OpenShift) Validate(c path.ContextPath) (r report.Report) { 35 | if os.KernelType != nil { 36 | switch *os.KernelType { 37 | case "", "default", "realtime": 38 | default: 39 | r.AddOnError(c.Append("kernel_type"), common.ErrInvalidKernelType) 40 | } 41 | } 42 | return 43 | } 44 | -------------------------------------------------------------------------------- /config/openshift/v4_17/schema.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License.) 14 | 15 | package v4_17 16 | 17 | import ( 18 | fcos "github.com/coreos/butane/config/fcos/v1_5" 19 | ) 20 | 21 | const ROLE_LABEL_KEY = "machineconfiguration.openshift.io/role" 22 | 23 | type Config struct { 24 | fcos.Config `yaml:",inline"` 25 | Metadata Metadata `yaml:"metadata"` 26 | OpenShift OpenShift `yaml:"openshift"` 27 | } 28 | 29 | type Metadata struct { 30 | Name string `yaml:"name"` 31 | Labels map[string]string `yaml:"labels,omitempty"` 32 | } 33 | 34 | type OpenShift struct { 35 | KernelArguments []string `yaml:"kernel_arguments"` 36 | Extensions []string `yaml:"extensions"` 37 | FIPS *bool `yaml:"fips"` 38 | KernelType *string `yaml:"kernel_type"` 39 | } 40 | -------------------------------------------------------------------------------- /config/openshift/v4_17/validate.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Red Hat, Inc 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License.) 14 | 15 | package v4_17 16 | 17 | import ( 18 | "github.com/coreos/butane/config/common" 19 | 20 | "github.com/coreos/vcontext/path" 21 | "github.com/coreos/vcontext/report" 22 | ) 23 | 24 | func (m Metadata) Validate(c path.ContextPath) (r report.Report) { 25 | if m.Name == "" { 26 | r.AddOnError(c.Append("name"), common.ErrNameRequired) 27 | } 28 | if m.Labels[ROLE_LABEL_KEY] == "" { 29 | r.AddOnError(c.Append("labels"), common.ErrRoleRequired) 30 | } 31 | return 32 | } 33 | 34 | func (os OpenShift) Validate(c path.ContextPath) (r report.Report) { 35 | if os.KernelType != nil { 36 | switch *os.KernelType { 37 | case "", "default", "realtime": 38 | default: 39 | r.AddOnError(c.Append("kernel_type"), common.ErrInvalidKernelType) 40 | } 41 | } 42 | return 43 | } 44 | -------------------------------------------------------------------------------- /config/openshift/v4_18/schema.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License.) 14 | 15 | package v4_18 16 | 17 | import ( 18 | fcos "github.com/coreos/butane/config/fcos/v1_5" 19 | ) 20 | 21 | const ROLE_LABEL_KEY = "machineconfiguration.openshift.io/role" 22 | 23 | type Config struct { 24 | fcos.Config `yaml:",inline"` 25 | Metadata Metadata `yaml:"metadata"` 26 | OpenShift OpenShift `yaml:"openshift"` 27 | } 28 | 29 | type Metadata struct { 30 | Name string `yaml:"name"` 31 | Labels map[string]string `yaml:"labels,omitempty"` 32 | } 33 | 34 | type OpenShift struct { 35 | KernelArguments []string `yaml:"kernel_arguments"` 36 | Extensions []string `yaml:"extensions"` 37 | FIPS *bool `yaml:"fips"` 38 | KernelType *string `yaml:"kernel_type"` 39 | } 40 | -------------------------------------------------------------------------------- /config/openshift/v4_18/validate.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Red Hat, Inc 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License.) 14 | 15 | package v4_18 16 | 17 | import ( 18 | "github.com/coreos/butane/config/common" 19 | 20 | "github.com/coreos/vcontext/path" 21 | "github.com/coreos/vcontext/report" 22 | ) 23 | 24 | func (m Metadata) Validate(c path.ContextPath) (r report.Report) { 25 | if m.Name == "" { 26 | r.AddOnError(c.Append("name"), common.ErrNameRequired) 27 | } 28 | if m.Labels[ROLE_LABEL_KEY] == "" { 29 | r.AddOnError(c.Append("labels"), common.ErrRoleRequired) 30 | } 31 | return 32 | } 33 | 34 | func (os OpenShift) Validate(c path.ContextPath) (r report.Report) { 35 | if os.KernelType != nil { 36 | switch *os.KernelType { 37 | case "", "default", "realtime": 38 | default: 39 | r.AddOnError(c.Append("kernel_type"), common.ErrInvalidKernelType) 40 | } 41 | } 42 | return 43 | } 44 | -------------------------------------------------------------------------------- /config/openshift/v4_19/schema.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License.) 14 | 15 | package v4_19 16 | 17 | import ( 18 | fcos "github.com/coreos/butane/config/fcos/v1_6" 19 | ) 20 | 21 | const ROLE_LABEL_KEY = "machineconfiguration.openshift.io/role" 22 | 23 | type Config struct { 24 | fcos.Config `yaml:",inline"` 25 | Metadata Metadata `yaml:"metadata"` 26 | OpenShift OpenShift `yaml:"openshift"` 27 | } 28 | 29 | type Metadata struct { 30 | Name string `yaml:"name"` 31 | Labels map[string]string `yaml:"labels,omitempty"` 32 | } 33 | 34 | type OpenShift struct { 35 | KernelArguments []string `yaml:"kernel_arguments"` 36 | Extensions []string `yaml:"extensions"` 37 | FIPS *bool `yaml:"fips"` 38 | KernelType *string `yaml:"kernel_type"` 39 | } 40 | -------------------------------------------------------------------------------- /config/openshift/v4_20_exp/schema.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License.) 14 | 15 | package v4_20_exp 16 | 17 | import ( 18 | fcos "github.com/coreos/butane/config/fcos/v1_7_exp" 19 | ) 20 | 21 | const ROLE_LABEL_KEY = "machineconfiguration.openshift.io/role" 22 | 23 | type Config struct { 24 | fcos.Config `yaml:",inline"` 25 | Metadata Metadata `yaml:"metadata"` 26 | OpenShift OpenShift `yaml:"openshift"` 27 | } 28 | 29 | type Metadata struct { 30 | Name string `yaml:"name"` 31 | Labels map[string]string `yaml:"labels,omitempty"` 32 | } 33 | 34 | type OpenShift struct { 35 | KernelArguments []string `yaml:"kernel_arguments"` 36 | Extensions []string `yaml:"extensions"` 37 | FIPS *bool `yaml:"fips"` 38 | KernelType *string `yaml:"kernel_type"` 39 | } 40 | -------------------------------------------------------------------------------- /config/openshift/v4_8/schema.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License.) 14 | 15 | package v4_8 16 | 17 | import ( 18 | fcos "github.com/coreos/butane/config/fcos/v1_3" 19 | ) 20 | 21 | const ROLE_LABEL_KEY = "machineconfiguration.openshift.io/role" 22 | 23 | type Config struct { 24 | fcos.Config `yaml:",inline"` 25 | Metadata Metadata `yaml:"metadata"` 26 | OpenShift OpenShift `yaml:"openshift"` 27 | } 28 | 29 | type Metadata struct { 30 | Name string `yaml:"name"` 31 | Labels map[string]string `yaml:"labels,omitempty"` 32 | } 33 | 34 | type OpenShift struct { 35 | KernelArguments []string `yaml:"kernel_arguments"` 36 | Extensions []string `yaml:"extensions"` 37 | FIPS *bool `yaml:"fips"` 38 | KernelType *string `yaml:"kernel_type"` 39 | } 40 | -------------------------------------------------------------------------------- /config/openshift/v4_8/validate.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Red Hat, Inc 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License.) 14 | 15 | package v4_8 16 | 17 | import ( 18 | "github.com/coreos/butane/config/common" 19 | 20 | "github.com/coreos/vcontext/path" 21 | "github.com/coreos/vcontext/report" 22 | ) 23 | 24 | func (m Metadata) Validate(c path.ContextPath) (r report.Report) { 25 | if m.Name == "" { 26 | r.AddOnError(c.Append("name"), common.ErrNameRequired) 27 | } 28 | if m.Labels[ROLE_LABEL_KEY] == "" { 29 | r.AddOnError(c.Append("labels"), common.ErrRoleRequired) 30 | } 31 | return 32 | } 33 | 34 | func (os OpenShift) Validate(c path.ContextPath) (r report.Report) { 35 | if os.KernelType != nil { 36 | switch *os.KernelType { 37 | case "", "default", "realtime": 38 | default: 39 | r.AddOnError(c.Append("kernel_type"), common.ErrInvalidKernelType) 40 | } 41 | } 42 | return 43 | } 44 | -------------------------------------------------------------------------------- /config/openshift/v4_9/schema.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License.) 14 | 15 | package v4_9 16 | 17 | import ( 18 | fcos "github.com/coreos/butane/config/fcos/v1_3" 19 | ) 20 | 21 | const ROLE_LABEL_KEY = "machineconfiguration.openshift.io/role" 22 | 23 | type Config struct { 24 | fcos.Config `yaml:",inline"` 25 | Metadata Metadata `yaml:"metadata"` 26 | OpenShift OpenShift `yaml:"openshift"` 27 | } 28 | 29 | type Metadata struct { 30 | Name string `yaml:"name"` 31 | Labels map[string]string `yaml:"labels,omitempty"` 32 | } 33 | 34 | type OpenShift struct { 35 | KernelArguments []string `yaml:"kernel_arguments"` 36 | Extensions []string `yaml:"extensions"` 37 | FIPS *bool `yaml:"fips"` 38 | KernelType *string `yaml:"kernel_type"` 39 | } 40 | -------------------------------------------------------------------------------- /config/openshift/v4_9/validate.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Red Hat, Inc 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License.) 14 | 15 | package v4_9 16 | 17 | import ( 18 | "github.com/coreos/butane/config/common" 19 | 20 | "github.com/coreos/vcontext/path" 21 | "github.com/coreos/vcontext/report" 22 | ) 23 | 24 | func (m Metadata) Validate(c path.ContextPath) (r report.Report) { 25 | if m.Name == "" { 26 | r.AddOnError(c.Append("name"), common.ErrNameRequired) 27 | } 28 | if m.Labels[ROLE_LABEL_KEY] == "" { 29 | r.AddOnError(c.Append("labels"), common.ErrRoleRequired) 30 | } 31 | return 32 | } 33 | 34 | func (os OpenShift) Validate(c path.ContextPath) (r report.Report) { 35 | if os.KernelType != nil { 36 | switch *os.KernelType { 37 | case "", "default", "realtime": 38 | default: 39 | r.AddOnError(c.Append("kernel_type"), common.ErrInvalidKernelType) 40 | } 41 | } 42 | return 43 | } 44 | -------------------------------------------------------------------------------- /config/r4e/v1_0/schema.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Red Hat, Inc 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License.) 14 | 15 | package v1_0 16 | 17 | import ( 18 | base "github.com/coreos/butane/base/v0_4" 19 | ) 20 | 21 | type Config struct { 22 | base.Config `yaml:",inline"` 23 | } 24 | -------------------------------------------------------------------------------- /config/r4e/v1_1/schema.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Red Hat, Inc 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License.) 14 | 15 | package v1_1 16 | 17 | import ( 18 | base "github.com/coreos/butane/base/v0_5" 19 | ) 20 | 21 | type Config struct { 22 | base.Config `yaml:",inline"` 23 | } 24 | -------------------------------------------------------------------------------- /config/r4e/v1_2_exp/schema.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Red Hat, Inc 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License.) 14 | 15 | package v1_2_exp 16 | 17 | import ( 18 | base "github.com/coreos/butane/base/v0_7_exp" 19 | ) 20 | 21 | type Config struct { 22 | base.Config `yaml:",inline"` 23 | } 24 | -------------------------------------------------------------------------------- /docs/_config.yml: -------------------------------------------------------------------------------- 1 | # Template generated by https://github.com/coreos/repo-templates; do not edit downstream 2 | 3 | # To test documentation changes locally or using GitHub Pages, see: 4 | # https://github.com/coreos/fedora-coreos-tracker/blob/main/docs/testing-project-documentation-changes.md 5 | 6 | title: Butane 7 | description: Butane documentation 8 | baseurl: "/butane" 9 | url: "https://coreos.github.io" 10 | permalink: /:title/ 11 | markdown: kramdown 12 | kramdown: 13 | typographic_symbols: 14 | ndash: "--" 15 | mdash: "---" 16 | 17 | remote_theme: just-the-docs/just-the-docs@v0.10.0 18 | plugins: 19 | - jekyll-remote-theme 20 | 21 | color_scheme: coreos 22 | 23 | # Aux links for the upper right navigation 24 | aux_links: 25 | "Butane on GitHub": 26 | - "https://github.com/coreos/butane" 27 | 28 | footer_content: "Copyright © Red Hat, Inc. and others." 29 | 30 | # Footer last edited timestamp 31 | last_edit_timestamp: true 32 | last_edit_time_format: "%b %e %Y at %I:%M %p" 33 | 34 | # Footer "Edit this page on GitHub" link text 35 | gh_edit_link: true 36 | gh_edit_link_text: "Edit this page on GitHub" 37 | gh_edit_repository: "https://github.com/coreos/butane" 38 | gh_edit_branch: "main" 39 | gh_edit_source: docs 40 | gh_edit_view_mode: "tree" 41 | 42 | compress_html: 43 | clippings: all 44 | comments: all 45 | endings: all 46 | startings: [] 47 | blanklines: false 48 | profile: false 49 | -------------------------------------------------------------------------------- /docs/_sass/color_schemes/coreos.scss: -------------------------------------------------------------------------------- 1 | $link-color: #53a3da; 2 | -------------------------------------------------------------------------------- /docs/_sass/custom/custom.scss: -------------------------------------------------------------------------------- 1 | #spec-docs ~ ul { 2 | ul { 3 | border-left: 1px solid $grey-lt-300; 4 | } 5 | 6 | li::before { 7 | margin-left: -0.8em; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /docs/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coreos/butane/3254a20ae43c200994fef014dc90cbd4371fa291/docs/favicon.ico -------------------------------------------------------------------------------- /docs/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | nav_order: 1 3 | --- 4 | 5 | # Butane 6 | 7 | Butane (formerly the Fedora CoreOS Config Transpiler, FCCT) translates human readable Butane Configs 8 | into machine readable [Ignition](https://coreos.github.io/ignition/) Configs. See the [getting 9 | started](getting-started) guide for how to use Butane and the [configuration specifications](specs.md) 10 | for everything Butane configs support. 11 | -------------------------------------------------------------------------------- /docs/upgrading.md: -------------------------------------------------------------------------------- 1 | --- 2 | has_children: true 3 | nav_order: 5 4 | has_toc: false 5 | --- 6 | 7 | # Upgrading configs 8 | 9 | Occasionally, changes are made to Butane configuration specifications that break backward compatibility or add new functionality. While this is not a concern for running machines, since Ignition only runs one time during first boot, it is a concern for those who maintain configuration files. 10 | 11 | For details about changes in new versions of Butane config specs, see the guide for your specific config variant: 12 | 13 | - [Fedora CoreOS](upgrading-fcos.md) (`fcos`) 14 | - [Flatcar](upgrading-flatcar.md) (`flatcar`) 15 | - [OpenShift](upgrading-openshift.md) (`openshift`) 16 | - [RHEL for Edge](upgrading-r4e.md) (`r4e`) 17 | -------------------------------------------------------------------------------- /generate: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -euo pipefail 4 | 5 | echo "Generating docs..." 6 | eval $(go env) 7 | if [ -z ${BIN_PATH+a} ]; then 8 | BIN_PATH=${PWD}/bin/$(go env GOARCH) 9 | fi 10 | go build -o ${BIN_PATH}/doc internal/doc/main.go 11 | ${BIN_PATH}/doc ${PWD}/docs 12 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/coreos/butane 2 | 3 | go 1.20 4 | 5 | require ( 6 | github.com/clarketm/json v1.17.1 7 | github.com/coreos/go-semver v0.3.1 8 | github.com/coreos/go-systemd/v22 v22.5.0 9 | github.com/coreos/ignition/v2 v2.21.0 10 | github.com/coreos/vcontext v0.0.0-20230201181013-d72178a18687 11 | github.com/spf13/pflag v1.0.6 12 | github.com/stretchr/testify v1.10.0 13 | github.com/vincent-petithory/dataurl v1.0.0 14 | gopkg.in/yaml.v3 v3.0.1 15 | ) 16 | 17 | require ( 18 | github.com/aws/aws-sdk-go v1.55.6 // indirect 19 | github.com/coreos/go-json v0.0.0-20230131223807-18775e0fb4fb // indirect 20 | github.com/davecgh/go-spew v1.1.1 // indirect 21 | github.com/kr/pretty v0.3.1 // indirect 22 | github.com/mitchellh/copystructure v1.2.0 // indirect 23 | github.com/mitchellh/reflectwalk v1.0.2 // indirect 24 | github.com/pmezard/go-difflib v1.0.0 // indirect 25 | gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect 26 | ) 27 | -------------------------------------------------------------------------------- /internal/doc/header.md: -------------------------------------------------------------------------------- 1 | --- 2 | # This file is automatically generated from internal/doc and Ignition's 3 | # config/doc. Do not edit. 4 | title: {{ .Variant }} v{{ .Version }} 5 | parent: Configuration specifications 6 | nav_order: {{ .NavOrder }} 7 | --- 8 | 9 | # {{ .Variant }} Specification v{{ .Version }} 10 | 11 | {{ if .Version.PreRelease -}} 12 | **Note: This configuration is experimental and has not been stabilized. It is subject to change without warning or announcement.** 13 | 14 | {{ end -}} 15 | The {{ .Variant }} configuration is a YAML document conforming to the following specification, with **_italicized_** entries being optional: 16 | 17 |
18 | 19 | -------------------------------------------------------------------------------- /internal/version/version.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package version 16 | 17 | import ( 18 | "fmt" 19 | ) 20 | 21 | var ( 22 | Raw = "was not built properly" 23 | String = fmt.Sprintf("Butane %s", Raw) 24 | ) 25 | -------------------------------------------------------------------------------- /plans/smoke.fmf: -------------------------------------------------------------------------------- 1 | summary: Basic smoke test 2 | discover: 3 | how: fmf 4 | filter: "tag: smoke" 5 | execute: 6 | how: tmt 7 | -------------------------------------------------------------------------------- /tag_release.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Maintained in https://github.com/coreos/repo-templates 3 | # Do not edit downstream. 4 | 5 | set -e 6 | 7 | [ $# == 2 ] || { echo "usage: $0 " && exit 1; } 8 | 9 | VER=$1 10 | COMMIT=$2 11 | 12 | [[ "${VER}" =~ ^v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+(-.+)?$ ]] || { 13 | echo "malformed version: \"${VER}\"" 14 | exit 2 15 | } 16 | 17 | [[ "${COMMIT}" =~ ^[[:xdigit:]]+$ ]] || { 18 | echo "malformed commit id: \"${COMMIT}\"" 19 | exit 3 20 | } 21 | 22 | if [ -f Makefile ]; then 23 | make 24 | else 25 | ./build 26 | fi 27 | 28 | git tag --sign --message "Butane ${VER}" "${VER}" "${COMMIT}" 29 | git verify-tag --verbose "${VER}" 30 | -------------------------------------------------------------------------------- /tests/main.fmf: -------------------------------------------------------------------------------- 1 | require: 2 | - butane 3 | -------------------------------------------------------------------------------- /tests/smoke/main.fmf: -------------------------------------------------------------------------------- 1 | summary: runs butane --version and checks return code 2 | test: ./test.sh 3 | tag: 4 | - smoke 5 | -------------------------------------------------------------------------------- /tests/smoke/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | butane --version 4 | -------------------------------------------------------------------------------- /translate/tests/pkga/types.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package pkga 16 | 17 | type Trivial struct { 18 | A string 19 | B int 20 | C bool 21 | } 22 | 23 | type Nested struct { 24 | D string 25 | Trivial 26 | } 27 | 28 | type TrivialReordered struct { 29 | B int 30 | A string 31 | C bool 32 | } 33 | 34 | type HasList struct { 35 | L []Trivial 36 | } 37 | 38 | type TrivialSkip struct { 39 | A string `butane:"auto_skip"` 40 | B int 41 | C bool 42 | } 43 | -------------------------------------------------------------------------------- /translate/tests/pkgb/types.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package pkgb 16 | 17 | type Trivial struct { 18 | A string 19 | B int 20 | C bool 21 | } 22 | 23 | type Nested struct { 24 | D string 25 | Trivial 26 | } 27 | 28 | // note: struct ordering is different from pkga 29 | type TrivialReordered struct { 30 | A string 31 | B int 32 | C bool 33 | } 34 | 35 | type HasList struct { 36 | L []Nested 37 | } 38 | 39 | type TrivialSkip struct { 40 | B int 41 | C bool 42 | } 43 | -------------------------------------------------------------------------------- /translate/tests/readme.txt: -------------------------------------------------------------------------------- 1 | Tests for this translator are in their own package since it needs to test 2 | translating from one package to another. This pattern should not be replicated 3 | in other places in the codebase 4 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/NOTICE.txt: -------------------------------------------------------------------------------- 1 | AWS SDK for Go 2 | Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | Copyright 2014-2015 Stripe, Inc. 4 | -------------------------------------------------------------------------------- /vendor/github.com/clarketm/json/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/github.com/clarketm/json/README.md: -------------------------------------------------------------------------------- 1 | # [json](https://godoc.org/github.com/clarketm/json) 2 | > Mirrors [golang/go](https://github.com/golang/go) [![Golang version](https://img.shields.io/badge/go-1.12.7-green)](https://github.com/golang/go/releases/tag/go1.12.7) 3 | 4 | Drop-in replacement for Golang [`encoding/json`](https://golang.org/pkg/encoding/json/) with additional features. 5 | 6 | ## Installation 7 | ```shell 8 | $ go get -u github.com/clarketm/json 9 | ``` 10 | 11 | ## Usage 12 | Same usage as Golang [`encoding/json`](https://golang.org/pkg/encoding/json/). 13 | 14 | ## Features 15 | - Support zero values of structs with `omitempty`: [golang/go#11939](https://github.com/golang/go/issues/11939). 16 | > If `omitempty` is applied to a struct and all the children of the struct are *empty*, then on marshalling it will be **omitted** from the encoded json. 17 | 18 | ## License 19 | Refer to the [Golang](https://github.com/golang/go/blob/master/LICENSE) license. See [LICENSE](LICENSE) for more information. 20 | -------------------------------------------------------------------------------- /vendor/github.com/clarketm/json/fuzz.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build gofuzz 6 | // +build gofuzz 7 | 8 | package json 9 | 10 | import ( 11 | "fmt" 12 | ) 13 | 14 | func Fuzz(data []byte) (score int) { 15 | for _, ctor := range []func() interface{}{ 16 | func() interface{} { return new(interface{}) }, 17 | func() interface{} { return new(map[string]interface{}) }, 18 | func() interface{} { return new([]interface{}) }, 19 | } { 20 | v := ctor() 21 | err := Unmarshal(data, v) 22 | if err != nil { 23 | continue 24 | } 25 | score = 1 26 | 27 | m, err := Marshal(v) 28 | if err != nil { 29 | fmt.Printf("v=%#v\n", v) 30 | panic(err) 31 | } 32 | 33 | u := ctor() 34 | err = Unmarshal(m, u) 35 | if err != nil { 36 | fmt.Printf("v=%#v\n", v) 37 | fmt.Printf("m=%s\n", m) 38 | panic(err) 39 | } 40 | } 41 | 42 | return 43 | } 44 | -------------------------------------------------------------------------------- /vendor/github.com/clarketm/json/tags.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package json 6 | 7 | import ( 8 | "strings" 9 | ) 10 | 11 | // tagOptions is the string following a comma in a struct field's "json" 12 | // tag, or the empty string. It does not include the leading comma. 13 | type tagOptions string 14 | 15 | // parseTag splits a struct field's json tag into its name and 16 | // comma-separated options. 17 | func parseTag(tag string) (string, tagOptions) { 18 | if idx := strings.Index(tag, ","); idx != -1 { 19 | return tag[:idx], tagOptions(tag[idx+1:]) 20 | } 21 | return tag, tagOptions("") 22 | } 23 | 24 | // Contains reports whether a comma-separated list of options 25 | // contains a particular substr flag. substr must be surrounded by a 26 | // string boundary or commas. 27 | func (o tagOptions) Contains(optionName string) bool { 28 | if len(o) == 0 { 29 | return false 30 | } 31 | s := string(o) 32 | for s != "" { 33 | var next string 34 | i := strings.Index(s, ",") 35 | if i >= 0 { 36 | s, next = s[:i], s[i+1:] 37 | } 38 | if s == optionName { 39 | return true 40 | } 41 | s = next 42 | } 43 | return false 44 | } 45 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/go-json/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/go-json/PATENTS: -------------------------------------------------------------------------------- 1 | Additional IP Rights Grant (Patents) 2 | 3 | "This implementation" means the copyrightable works distributed by 4 | Google as part of the Go project. 5 | 6 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 7 | no-charge, royalty-free, irrevocable (except as stated in this section) 8 | patent license to make, have made, use, offer to sell, sell, import, 9 | transfer and otherwise run, modify and propagate the contents of this 10 | implementation of Go, where such license applies only to those patent 11 | claims, both currently owned or controlled by Google and acquired in 12 | the future, licensable by Google that are necessarily infringed by this 13 | implementation of Go. This grant does not include claims that would be 14 | infringed only as a consequence of further modification of this 15 | implementation. If you or your agent or exclusive licensee institute or 16 | order or agree to the institution of patent litigation against any 17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 18 | that this implementation of Go or any code incorporated within this 19 | implementation of Go constitutes direct or contributory patent 20 | infringement, or inducement of patent infringement, then any patent 21 | rights granted to you under this License for this implementation of Go 22 | shall terminate as of the date such litigation is filed. 23 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/go-json/README.md: -------------------------------------------------------------------------------- 1 | # go-json 2 | 3 | This is a fork of Go's `encoding/json` library. It adds a third target for 4 | unmarshalling, `json.Node`. 5 | 6 | Unmarshalling to a `Node` behaves similarly to unmarshalling to 7 | `any`, except that it also records the offsets for the start and end 8 | of the value that is unmarshalled and, if the value is part of a JSON 9 | object, the offsets of the start and end of the object's key. The `Value` 10 | field of the `Node` is unmarshalled to the same type as if it were 11 | `any`, except in the case of arrays and objects: 12 | 13 | | JSON type | Go type, unmarshalled to `any` | `Node.Value` type | 14 | | --------- | ------------------------------ | ----------------- | 15 | | Array | `[]any` | `[]Node` | 16 | | Object | `map[string]any` | `map[string]Node` | 17 | | Other | `any` | `any` | 18 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/go-json/fuzz.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build gofuzz 6 | 7 | package json 8 | 9 | import ( 10 | "fmt" 11 | ) 12 | 13 | func Fuzz(data []byte) (score int) { 14 | for _, ctor := range []func() any{ 15 | func() any { return new(any) }, 16 | func() any { return new(map[string]any) }, 17 | func() any { return new([]any) }, 18 | } { 19 | v := ctor() 20 | err := Unmarshal(data, v) 21 | if err != nil { 22 | continue 23 | } 24 | score = 1 25 | 26 | m, err := Marshal(v) 27 | if err != nil { 28 | fmt.Printf("v=%#v\n", v) 29 | panic(err) 30 | } 31 | 32 | u := ctor() 33 | err = Unmarshal(m, u) 34 | if err != nil { 35 | fmt.Printf("v=%#v\n", v) 36 | fmt.Printf("m=%s\n", m) 37 | panic(err) 38 | } 39 | } 40 | 41 | return 42 | } 43 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/go-json/tags.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package json 6 | 7 | import ( 8 | "strings" 9 | ) 10 | 11 | // tagOptions is the string following a comma in a struct field's "json" 12 | // tag, or the empty string. It does not include the leading comma. 13 | type tagOptions string 14 | 15 | // parseTag splits a struct field's json tag into its name and 16 | // comma-separated options. 17 | func parseTag(tag string) (string, tagOptions) { 18 | tag, opt, _ := strings.Cut(tag, ",") 19 | return tag, tagOptions(opt) 20 | } 21 | 22 | // Contains reports whether a comma-separated list of options 23 | // contains a particular substr flag. substr must be surrounded by a 24 | // string boundary or commas. 25 | func (o tagOptions) Contains(optionName string) bool { 26 | if len(o) == 0 { 27 | return false 28 | } 29 | s := string(o) 30 | for s != "" { 31 | var name string 32 | name, s, _ = strings.Cut(s, ",") 33 | if name == optionName { 34 | return true 35 | } 36 | } 37 | return false 38 | } 39 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/go-semver/NOTICE: -------------------------------------------------------------------------------- 1 | CoreOS Project 2 | Copyright 2018 CoreOS, Inc 3 | 4 | This product includes software developed at CoreOS, Inc. 5 | (http://www.coreos.com/). 6 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/go-semver/semver/sort.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2015 CoreOS, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package semver 16 | 17 | import ( 18 | "sort" 19 | ) 20 | 21 | type Versions []*Version 22 | 23 | func (s Versions) Len() int { 24 | return len(s) 25 | } 26 | 27 | func (s Versions) Swap(i, j int) { 28 | s[i], s[j] = s[j], s[i] 29 | } 30 | 31 | func (s Versions) Less(i, j int) bool { 32 | return s[i].LessThan(*s[j]) 33 | } 34 | 35 | // Sort sorts the given slice of Version 36 | func Sort(versions []*Version) { 37 | sort.Sort(Versions(versions)) 38 | } 39 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/go-systemd/v22/NOTICE: -------------------------------------------------------------------------------- 1 | CoreOS Project 2 | Copyright 2018 CoreOS, Inc 3 | 4 | This product includes software developed at CoreOS, Inc. 5 | (http://www.coreos.com/). 6 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/go-systemd/v22/unit/section.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 CoreOS, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package unit 16 | 17 | // UnitEntry is a single line entry in a Unit file. 18 | type UnitEntry struct { 19 | Name string 20 | Value string 21 | } 22 | 23 | // UnitSection is a section in a Unit file. The section name 24 | // and a list of entries in that section. 25 | type UnitSection struct { 26 | Section string 27 | Entries []*UnitEntry 28 | } 29 | 30 | // String implements the stringify interface for UnitEntry 31 | func (u *UnitEntry) String() string { 32 | return "{Name: " + u.Name + ", " + "Value: " + u.Value + "}" 33 | } 34 | 35 | // String implements the stringify interface for UnitSection 36 | func (s *UnitSection) String() string { 37 | result := "{Section: " + s.Section 38 | for _, e := range s.Entries { 39 | result += e.String() 40 | } 41 | 42 | result += "}" 43 | return result 44 | } 45 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/NOTICE: -------------------------------------------------------------------------------- 1 | CoreOS Project 2 | Copyright 2015 CoreOS, Inc 3 | 4 | This product includes software developed at CoreOS, Inc. 5 | (http://www.coreos.com/). 6 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/shared/parse/unit.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // Package parse contains a function for parsing unit contents shared between 16 | // multiple config versions. 17 | package parse 18 | 19 | import ( 20 | "fmt" 21 | "strings" 22 | 23 | "github.com/coreos/go-systemd/v22/unit" 24 | ) 25 | 26 | // ParseUnitContents parses the content of a given unit 27 | func ParseUnitContents(content *string) ([]*unit.UnitOption, error) { 28 | if content == nil { 29 | return []*unit.UnitOption{}, nil 30 | } 31 | c := strings.NewReader(*content) 32 | opts, err := unit.Deserialize(c) 33 | if err != nil { 34 | return nil, fmt.Errorf("invalid unit content: %s", err) 35 | } 36 | return opts, nil 37 | } 38 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/util/config.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package util 16 | 17 | import ( 18 | "github.com/coreos/ignition/v2/config/shared/errors" 19 | 20 | "github.com/coreos/go-semver/semver" 21 | "github.com/coreos/vcontext/report" 22 | ) 23 | 24 | type versionStub struct { 25 | Ignition struct { 26 | Version string 27 | } 28 | } 29 | 30 | // GetConfigVersion parses the version from the given raw config 31 | func GetConfigVersion(raw []byte) (semver.Version, report.Report, error) { 32 | if len(raw) == 0 { 33 | return semver.Version{}, report.Report{}, errors.ErrEmpty 34 | } 35 | 36 | stub := versionStub{} 37 | if rpt, err := HandleParseErrors(raw, &stub); err != nil { 38 | return semver.Version{}, rpt, err 39 | } 40 | 41 | version, err := semver.NewVersion(stub.Ignition.Version) 42 | if err != nil { 43 | return semver.Version{}, report.Report{}, errors.ErrInvalidVersion 44 | } 45 | return *version, report.Report{}, nil 46 | } 47 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/util/helpers.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 CoreOS, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package util 16 | 17 | func IntToPtr(x int) *int { 18 | return &x 19 | } 20 | 21 | func StrToPtr(s string) *string { 22 | return &s 23 | } 24 | 25 | func BoolToPtr(b bool) *bool { 26 | return &b 27 | } 28 | 29 | func NilOrEmpty(s *string) bool { 30 | return s == nil || *s == "" 31 | } 32 | 33 | func NotEmpty(s *string) bool { 34 | return s != nil && *s != "" 35 | } 36 | 37 | func IsTrue(b *bool) bool { 38 | return b != nil && *b 39 | } 40 | 41 | func IsFalse(b *bool) bool { 42 | return b != nil && !*b 43 | } 44 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/util/interfaces.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package util 16 | 17 | import ( 18 | "reflect" 19 | ) 20 | 21 | type MergesKeys interface { 22 | MergedKeys() map[string]string 23 | } 24 | 25 | type IgnoresDups interface { 26 | IgnoreDuplicates() map[string]struct{} 27 | } 28 | 29 | type Keyed interface { 30 | Key() string 31 | } 32 | 33 | // CallKey is a helper to call the Key() function since this needs to happen a lot 34 | func CallKey(v reflect.Value) string { 35 | if v.Kind() == reflect.String { 36 | return v.Convert(reflect.TypeOf("")).Interface().(string) 37 | } 38 | return v.Interface().(Keyed).Key() 39 | } 40 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_0/types/ca.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 CoreOS, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "github.com/coreos/vcontext/path" 19 | "github.com/coreos/vcontext/report" 20 | ) 21 | 22 | func (c CaReference) Key() string { 23 | return c.Source 24 | } 25 | 26 | func (ca CaReference) Validate(c path.ContextPath) (r report.Report) { 27 | r.AddOnError(c.Append("source"), validateURL(ca.Source)) 28 | return 29 | } 30 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_0/types/device.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "github.com/coreos/vcontext/path" 19 | "github.com/coreos/vcontext/report" 20 | ) 21 | 22 | func (d Device) Validate(c path.ContextPath) (r report.Report) { 23 | r.AddOnError(c, validatePath(string(d))) 24 | return 25 | } 26 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_0/types/directory.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 CoreOS, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "github.com/coreos/vcontext/path" 19 | "github.com/coreos/vcontext/report" 20 | ) 21 | 22 | func (d Directory) Validate(c path.ContextPath) (r report.Report) { 23 | r.Merge(d.Node.Validate(c)) 24 | r.AddOnError(c.Append("mode"), validateMode(d.Mode)) 25 | r.AddOnWarn(c.Append("mode"), validateModeSpecialBits(d.Mode)) 26 | return 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_0/types/ignition.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 CoreOS, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "github.com/coreos/go-semver/semver" 19 | 20 | "github.com/coreos/ignition/v2/config/shared/errors" 21 | 22 | "github.com/coreos/vcontext/path" 23 | "github.com/coreos/vcontext/report" 24 | ) 25 | 26 | func (c ConfigReference) Key() string { 27 | if c.Source == nil { 28 | return "" 29 | } 30 | return *c.Source 31 | } 32 | 33 | func (cr ConfigReference) Validate(c path.ContextPath) (r report.Report) { 34 | r.AddOnError(c.Append("source"), validateURLNilOK(cr.Source)) 35 | return 36 | } 37 | 38 | func (v Ignition) Semver() (*semver.Version, error) { 39 | return semver.NewVersion(v.Version) 40 | } 41 | 42 | func (v Ignition) Validate(c path.ContextPath) (r report.Report) { 43 | c = c.Append("version") 44 | tv, err := v.Semver() 45 | if err != nil { 46 | r.AddOnError(c, errors.ErrInvalidVersion) 47 | return 48 | } 49 | 50 | if MaxVersion != *tv { 51 | r.AddOnError(c, errors.ErrUnknownVersion) 52 | } 53 | return 54 | } 55 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_0/types/mode.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 CoreOS, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "github.com/coreos/ignition/v2/config/shared/errors" 19 | ) 20 | 21 | func validateMode(m *int) error { 22 | if m != nil && (*m < 0 || *m > 07777) { 23 | return errors.ErrFileIllegalMode 24 | } 25 | return nil 26 | } 27 | 28 | func validateModeSpecialBits(m *int) error { 29 | if m != nil { 30 | mode := uint32(*m) 31 | if mode&07000 != 0 { 32 | return errors.ErrModeSpecialBits 33 | } 34 | } 35 | return nil 36 | } 37 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_0/types/passwd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 CoreOS, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | func (p PasswdUser) Key() string { 18 | return p.Name 19 | } 20 | 21 | func (g PasswdGroup) Key() string { 22 | return g.Name 23 | } 24 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_0/types/path.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 CoreOS, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "path" 19 | 20 | "github.com/coreos/ignition/v2/config/shared/errors" 21 | "github.com/coreos/ignition/v2/config/util" 22 | ) 23 | 24 | func validatePath(p string) error { 25 | if p == "" { 26 | return errors.ErrNoPath 27 | } 28 | if !path.IsAbs(p) { 29 | return errors.ErrPathRelative 30 | } 31 | if path.Clean(p) != p { 32 | return errors.ErrDirtyPath 33 | } 34 | return nil 35 | } 36 | 37 | func validatePathNilOK(p *string) error { 38 | if util.NilOrEmpty(p) { 39 | return nil 40 | } 41 | return validatePath(*p) 42 | } 43 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_0/types/url.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 CoreOS, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "net/url" 19 | 20 | "github.com/vincent-petithory/dataurl" 21 | 22 | "github.com/coreos/ignition/v2/config/shared/errors" 23 | "github.com/coreos/ignition/v2/config/util" 24 | ) 25 | 26 | func validateURL(s string) error { 27 | u, err := url.Parse(s) 28 | if err != nil { 29 | return errors.ErrInvalidUrl 30 | } 31 | 32 | switch u.Scheme { 33 | case "http", "https", "tftp": 34 | return nil 35 | case "s3": 36 | if v, ok := u.Query()["versionId"]; ok { 37 | if len(v) == 0 || v[0] == "" { 38 | return errors.ErrInvalidS3ObjectVersionId 39 | } 40 | } 41 | return nil 42 | case "data": 43 | if _, err := dataurl.DecodeString(s); err != nil { 44 | return err 45 | } 46 | return nil 47 | default: 48 | return errors.ErrInvalidScheme 49 | } 50 | } 51 | 52 | func validateURLNilOK(s *string) error { 53 | if util.NilOrEmpty(s) { 54 | return nil 55 | } 56 | return validateURL(*s) 57 | } 58 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_1/types/device.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "github.com/coreos/vcontext/path" 19 | "github.com/coreos/vcontext/report" 20 | ) 21 | 22 | func (d Device) Validate(c path.ContextPath) (r report.Report) { 23 | r.AddOnError(c, validatePath(string(d))) 24 | return 25 | } 26 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_1/types/directory.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 CoreOS, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "github.com/coreos/vcontext/path" 19 | "github.com/coreos/vcontext/report" 20 | ) 21 | 22 | func (d Directory) Validate(c path.ContextPath) (r report.Report) { 23 | r.Merge(d.Node.Validate(c)) 24 | r.AddOnError(c.Append("mode"), validateMode(d.Mode)) 25 | r.AddOnWarn(c.Append("mode"), validateModeSpecialBits(d.Mode)) 26 | return 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_1/types/file.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 CoreOS, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "github.com/coreos/ignition/v2/config/shared/errors" 19 | "github.com/coreos/ignition/v2/config/util" 20 | 21 | "github.com/coreos/vcontext/path" 22 | "github.com/coreos/vcontext/report" 23 | ) 24 | 25 | func (f File) Validate(c path.ContextPath) (r report.Report) { 26 | r.Merge(f.Node.Validate(c)) 27 | r.AddOnError(c.Append("mode"), validateMode(f.Mode)) 28 | r.AddOnWarn(c.Append("mode"), validateModeSpecialBits(f.Mode)) 29 | r.AddOnError(c.Append("overwrite"), f.validateOverwrite()) 30 | return 31 | } 32 | 33 | func (f File) validateOverwrite() error { 34 | if util.IsTrue(f.Overwrite) && f.Contents.Source == nil { 35 | return errors.ErrOverwriteAndNilSource 36 | } 37 | return nil 38 | } 39 | 40 | func (f FileEmbedded1) IgnoreDuplicates() map[string]struct{} { 41 | return map[string]struct{}{ 42 | "Append": {}, 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_1/types/ignition.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 CoreOS, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "github.com/coreos/go-semver/semver" 19 | 20 | "github.com/coreos/ignition/v2/config/shared/errors" 21 | 22 | "github.com/coreos/vcontext/path" 23 | "github.com/coreos/vcontext/report" 24 | ) 25 | 26 | func (v Ignition) Semver() (*semver.Version, error) { 27 | return semver.NewVersion(v.Version) 28 | } 29 | 30 | func (ic IgnitionConfig) Validate(c path.ContextPath) (r report.Report) { 31 | for i, res := range ic.Merge { 32 | r.AddOnError(c.Append("merge", i), res.validateRequiredSource()) 33 | } 34 | return 35 | } 36 | 37 | func (v Ignition) Validate(c path.ContextPath) (r report.Report) { 38 | c = c.Append("version") 39 | tv, err := v.Semver() 40 | if err != nil { 41 | r.AddOnError(c, errors.ErrInvalidVersion) 42 | return 43 | } 44 | 45 | if MaxVersion != *tv { 46 | r.AddOnError(c, errors.ErrUnknownVersion) 47 | } 48 | return 49 | } 50 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_1/types/mode.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 CoreOS, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "github.com/coreos/ignition/v2/config/shared/errors" 19 | ) 20 | 21 | func validateMode(m *int) error { 22 | if m != nil && (*m < 0 || *m > 07777) { 23 | return errors.ErrFileIllegalMode 24 | } 25 | return nil 26 | } 27 | 28 | func validateModeSpecialBits(m *int) error { 29 | if m != nil { 30 | mode := uint32(*m) 31 | if mode&07000 != 0 { 32 | return errors.ErrModeSpecialBits 33 | } 34 | } 35 | return nil 36 | } 37 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_1/types/passwd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 CoreOS, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | func (p PasswdUser) Key() string { 18 | return p.Name 19 | } 20 | 21 | func (g PasswdGroup) Key() string { 22 | return g.Name 23 | } 24 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_1/types/path.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 CoreOS, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "path" 19 | 20 | "github.com/coreos/ignition/v2/config/shared/errors" 21 | "github.com/coreos/ignition/v2/config/util" 22 | ) 23 | 24 | func validatePath(p string) error { 25 | if p == "" { 26 | return errors.ErrNoPath 27 | } 28 | if !path.IsAbs(p) { 29 | return errors.ErrPathRelative 30 | } 31 | if path.Clean(p) != p { 32 | return errors.ErrDirtyPath 33 | } 34 | return nil 35 | } 36 | 37 | func validatePathNilOK(p *string) error { 38 | if util.NilOrEmpty(p) { 39 | return nil 40 | } 41 | return validatePath(*p) 42 | } 43 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_1/types/proxy.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "net/url" 19 | 20 | "github.com/coreos/ignition/v2/config/shared/errors" 21 | 22 | "github.com/coreos/vcontext/path" 23 | "github.com/coreos/vcontext/report" 24 | ) 25 | 26 | func (p Proxy) Validate(c path.ContextPath) (r report.Report) { 27 | validateProxyURL(p.HTTPProxy, c.Append("httpProxy"), &r, true) 28 | validateProxyURL(p.HTTPSProxy, c.Append("httpsProxy"), &r, false) 29 | return 30 | } 31 | 32 | func validateProxyURL(s *string, p path.ContextPath, r *report.Report, httpOk bool) { 33 | if s == nil { 34 | return 35 | } 36 | u, err := url.Parse(*s) 37 | if err != nil { 38 | r.AddOnError(p, errors.ErrInvalidUrl) 39 | return 40 | } 41 | 42 | if u.Scheme != "https" && u.Scheme != "http" { 43 | r.AddOnError(p, errors.ErrInvalidProxy) 44 | return 45 | } 46 | if u.Scheme == "http" && !httpOk { 47 | r.AddOnWarn(p, errors.ErrInsecureProxy) 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_1/types/tls.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "github.com/coreos/vcontext/path" 19 | "github.com/coreos/vcontext/report" 20 | ) 21 | 22 | func (tls TLS) Validate(c path.ContextPath) (r report.Report) { 23 | for i, ca := range tls.CertificateAuthorities { 24 | r.AddOnError(c.Append("certificateAuthorities", i), ca.validateRequiredSource()) 25 | } 26 | return 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_1/types/url.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 CoreOS, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "net/url" 19 | 20 | "github.com/vincent-petithory/dataurl" 21 | 22 | "github.com/coreos/ignition/v2/config/shared/errors" 23 | "github.com/coreos/ignition/v2/config/util" 24 | ) 25 | 26 | func validateURL(s string) error { 27 | u, err := url.Parse(s) 28 | if err != nil { 29 | return errors.ErrInvalidUrl 30 | } 31 | 32 | switch u.Scheme { 33 | case "http", "https", "tftp": 34 | return nil 35 | case "s3": 36 | if v, ok := u.Query()["versionId"]; ok { 37 | if len(v) == 0 || v[0] == "" { 38 | return errors.ErrInvalidS3ObjectVersionId 39 | } 40 | } 41 | return nil 42 | case "data": 43 | if _, err := dataurl.DecodeString(s); err != nil { 44 | return err 45 | } 46 | return nil 47 | default: 48 | return errors.ErrInvalidScheme 49 | } 50 | } 51 | 52 | func validateURLNilOK(s *string) error { 53 | if util.NilOrEmpty(s) { 54 | return nil 55 | } 56 | return validateURL(*s) 57 | } 58 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_2/types/custom.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "github.com/coreos/ignition/v2/config/shared/errors" 19 | 20 | "github.com/coreos/vcontext/path" 21 | "github.com/coreos/vcontext/report" 22 | ) 23 | 24 | func (cu Custom) Validate(c path.ContextPath) (r report.Report) { 25 | if cu.Pin == "" && cu.Config == "" { 26 | return 27 | } 28 | switch cu.Pin { 29 | case "tpm2", "tang", "sss": 30 | default: 31 | r.AddOnError(c.Append("pin"), errors.ErrUnknownClevisPin) 32 | } 33 | if cu.Config == "" { 34 | r.AddOnError(c.Append("config"), errors.ErrClevisConfigRequired) 35 | } 36 | return 37 | } 38 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_2/types/device.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "github.com/coreos/vcontext/path" 19 | "github.com/coreos/vcontext/report" 20 | ) 21 | 22 | func (d Device) Validate(c path.ContextPath) (r report.Report) { 23 | r.AddOnError(c, validatePath(string(d))) 24 | return 25 | } 26 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_2/types/directory.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "github.com/coreos/vcontext/path" 19 | "github.com/coreos/vcontext/report" 20 | ) 21 | 22 | func (d Directory) Validate(c path.ContextPath) (r report.Report) { 23 | r.Merge(d.Node.Validate(c)) 24 | r.AddOnError(c.Append("mode"), validateMode(d.Mode)) 25 | r.AddOnWarn(c.Append("mode"), validateModeSpecialBits(d.Mode)) 26 | return 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_2/types/file.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "github.com/coreos/ignition/v2/config/shared/errors" 19 | "github.com/coreos/ignition/v2/config/util" 20 | 21 | "github.com/coreos/vcontext/path" 22 | "github.com/coreos/vcontext/report" 23 | ) 24 | 25 | func (f File) Validate(c path.ContextPath) (r report.Report) { 26 | r.Merge(f.Node.Validate(c)) 27 | r.AddOnError(c.Append("mode"), validateMode(f.Mode)) 28 | r.AddOnWarn(c.Append("mode"), validateModeSpecialBits(f.Mode)) 29 | r.AddOnError(c.Append("overwrite"), f.validateOverwrite()) 30 | return 31 | } 32 | 33 | func (f File) validateOverwrite() error { 34 | if util.IsTrue(f.Overwrite) && f.Contents.Source == nil { 35 | return errors.ErrOverwriteAndNilSource 36 | } 37 | return nil 38 | } 39 | 40 | func (f FileEmbedded1) IgnoreDuplicates() map[string]struct{} { 41 | return map[string]struct{}{ 42 | "Append": {}, 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_2/types/ignition.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "github.com/coreos/go-semver/semver" 19 | 20 | "github.com/coreos/ignition/v2/config/shared/errors" 21 | 22 | "github.com/coreos/vcontext/path" 23 | "github.com/coreos/vcontext/report" 24 | ) 25 | 26 | func (v Ignition) Semver() (*semver.Version, error) { 27 | return semver.NewVersion(v.Version) 28 | } 29 | 30 | func (ic IgnitionConfig) Validate(c path.ContextPath) (r report.Report) { 31 | for i, res := range ic.Merge { 32 | r.AddOnError(c.Append("merge", i), res.validateRequiredSource()) 33 | } 34 | return 35 | } 36 | 37 | func (v Ignition) Validate(c path.ContextPath) (r report.Report) { 38 | c = c.Append("version") 39 | tv, err := v.Semver() 40 | if err != nil { 41 | r.AddOnError(c, errors.ErrInvalidVersion) 42 | return 43 | } 44 | 45 | if MaxVersion != *tv { 46 | r.AddOnError(c, errors.ErrUnknownVersion) 47 | } 48 | return 49 | } 50 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_2/types/mode.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "github.com/coreos/ignition/v2/config/shared/errors" 19 | ) 20 | 21 | func validateMode(m *int) error { 22 | if m != nil && (*m < 0 || *m > 07777) { 23 | return errors.ErrFileIllegalMode 24 | } 25 | return nil 26 | } 27 | 28 | func validateModeSpecialBits(m *int) error { 29 | if m != nil { 30 | mode := uint32(*m) 31 | if mode&07000 != 0 { 32 | return errors.ErrModeSpecialBits 33 | } 34 | } 35 | return nil 36 | } 37 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_2/types/passwd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | func (p PasswdUser) Key() string { 18 | return p.Name 19 | } 20 | 21 | func (g PasswdGroup) Key() string { 22 | return g.Name 23 | } 24 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_2/types/path.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "path" 19 | 20 | "github.com/coreos/ignition/v2/config/shared/errors" 21 | "github.com/coreos/ignition/v2/config/util" 22 | ) 23 | 24 | func validatePath(p string) error { 25 | if p == "" { 26 | return errors.ErrNoPath 27 | } 28 | if !path.IsAbs(p) { 29 | return errors.ErrPathRelative 30 | } 31 | if path.Clean(p) != p { 32 | return errors.ErrDirtyPath 33 | } 34 | return nil 35 | } 36 | 37 | func validatePathNilOK(p *string) error { 38 | if util.NilOrEmpty(p) { 39 | return nil 40 | } 41 | return validatePath(*p) 42 | } 43 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_2/types/proxy.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "net/url" 19 | 20 | "github.com/coreos/ignition/v2/config/shared/errors" 21 | 22 | "github.com/coreos/vcontext/path" 23 | "github.com/coreos/vcontext/report" 24 | ) 25 | 26 | func (p Proxy) Validate(c path.ContextPath) (r report.Report) { 27 | validateProxyURL(p.HTTPProxy, c.Append("httpProxy"), &r, true) 28 | validateProxyURL(p.HTTPSProxy, c.Append("httpsProxy"), &r, false) 29 | return 30 | } 31 | 32 | func validateProxyURL(s *string, p path.ContextPath, r *report.Report, httpOk bool) { 33 | if s == nil { 34 | return 35 | } 36 | u, err := url.Parse(*s) 37 | if err != nil { 38 | r.AddOnError(p, errors.ErrInvalidUrl) 39 | return 40 | } 41 | 42 | if u.Scheme != "https" && u.Scheme != "http" { 43 | r.AddOnError(p, errors.ErrInvalidProxy) 44 | return 45 | } 46 | if u.Scheme == "http" && !httpOk { 47 | r.AddOnWarn(p, errors.ErrInsecureProxy) 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_2/types/tang.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "net/url" 19 | 20 | "github.com/coreos/ignition/v2/config/shared/errors" 21 | "github.com/coreos/ignition/v2/config/util" 22 | 23 | "github.com/coreos/vcontext/path" 24 | "github.com/coreos/vcontext/report" 25 | ) 26 | 27 | func (t Tang) Key() string { 28 | return t.URL 29 | } 30 | 31 | func (t Tang) Validate(c path.ContextPath) (r report.Report) { 32 | r.AddOnError(c.Append("url"), validateTangURL(t.URL)) 33 | if util.NilOrEmpty(t.Thumbprint) { 34 | r.AddOnError(c.Append("thumbprint"), errors.ErrTangThumbprintRequired) 35 | } 36 | return 37 | } 38 | 39 | func validateTangURL(s string) error { 40 | u, err := url.Parse(s) 41 | if err != nil { 42 | return errors.ErrInvalidUrl 43 | } 44 | 45 | switch u.Scheme { 46 | case "http", "https": 47 | return nil 48 | default: 49 | return errors.ErrInvalidScheme 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_2/types/tls.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "github.com/coreos/vcontext/path" 19 | "github.com/coreos/vcontext/report" 20 | ) 21 | 22 | func (tls TLS) Validate(c path.ContextPath) (r report.Report) { 23 | for i, ca := range tls.CertificateAuthorities { 24 | r.AddOnError(c.Append("certificateAuthorities", i), ca.validateRequiredSource()) 25 | } 26 | return 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_2/types/url.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "net/url" 19 | 20 | "github.com/vincent-petithory/dataurl" 21 | 22 | "github.com/coreos/ignition/v2/config/shared/errors" 23 | "github.com/coreos/ignition/v2/config/util" 24 | ) 25 | 26 | func validateURL(s string) error { 27 | u, err := url.Parse(s) 28 | if err != nil { 29 | return errors.ErrInvalidUrl 30 | } 31 | 32 | switch u.Scheme { 33 | case "http", "https", "tftp", "gs": 34 | return nil 35 | case "s3": 36 | if v, ok := u.Query()["versionId"]; ok { 37 | if len(v) == 0 || v[0] == "" { 38 | return errors.ErrInvalidS3ObjectVersionId 39 | } 40 | } 41 | return nil 42 | case "data": 43 | if _, err := dataurl.DecodeString(s); err != nil { 44 | return err 45 | } 46 | return nil 47 | default: 48 | return errors.ErrInvalidScheme 49 | } 50 | } 51 | 52 | func validateURLNilOK(s *string) error { 53 | if util.NilOrEmpty(s) { 54 | return nil 55 | } 56 | return validateURL(*s) 57 | } 58 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_3/types/clevis.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "github.com/coreos/ignition/v2/config/shared/errors" 19 | "github.com/coreos/ignition/v2/config/util" 20 | 21 | "github.com/coreos/vcontext/path" 22 | "github.com/coreos/vcontext/report" 23 | ) 24 | 25 | func (c Clevis) IsPresent() bool { 26 | return util.NotEmpty(c.Custom.Pin) || 27 | len(c.Tang) > 0 || 28 | util.IsTrue(c.Tpm2) || 29 | c.Threshold != nil && *c.Threshold != 0 30 | } 31 | 32 | func (cu ClevisCustom) Validate(c path.ContextPath) (r report.Report) { 33 | if util.NilOrEmpty(cu.Pin) && util.NilOrEmpty(cu.Config) && !util.IsTrue(cu.NeedsNetwork) { 34 | return 35 | } 36 | if util.NotEmpty(cu.Pin) { 37 | switch *cu.Pin { 38 | case "tpm2", "tang", "sss": 39 | default: 40 | r.AddOnError(c.Append("pin"), errors.ErrUnknownClevisPin) 41 | } 42 | } else { 43 | r.AddOnError(c.Append("pin"), errors.ErrClevisPinRequired) 44 | } 45 | if util.NilOrEmpty(cu.Config) { 46 | r.AddOnError(c.Append("config"), errors.ErrClevisConfigRequired) 47 | } 48 | return 49 | } 50 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_3/types/device.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "github.com/coreos/vcontext/path" 19 | "github.com/coreos/vcontext/report" 20 | ) 21 | 22 | func (d Device) Validate(c path.ContextPath) (r report.Report) { 23 | r.AddOnError(c, validatePath(string(d))) 24 | return 25 | } 26 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_3/types/directory.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "github.com/coreos/vcontext/path" 19 | "github.com/coreos/vcontext/report" 20 | ) 21 | 22 | func (d Directory) Validate(c path.ContextPath) (r report.Report) { 23 | r.Merge(d.Node.Validate(c)) 24 | r.AddOnError(c.Append("mode"), validateMode(d.Mode)) 25 | r.AddOnWarn(c.Append("mode"), validateModeSpecialBits(d.Mode)) 26 | return 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_3/types/file.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "github.com/coreos/ignition/v2/config/shared/errors" 19 | "github.com/coreos/ignition/v2/config/util" 20 | 21 | "github.com/coreos/vcontext/path" 22 | "github.com/coreos/vcontext/report" 23 | ) 24 | 25 | func (f File) Validate(c path.ContextPath) (r report.Report) { 26 | r.Merge(f.Node.Validate(c)) 27 | r.AddOnError(c.Append("mode"), validateMode(f.Mode)) 28 | r.AddOnWarn(c.Append("mode"), validateModeSpecialBits(f.Mode)) 29 | r.AddOnError(c.Append("overwrite"), f.validateOverwrite()) 30 | return 31 | } 32 | 33 | func (f File) validateOverwrite() error { 34 | if util.IsTrue(f.Overwrite) && f.Contents.Source == nil { 35 | return errors.ErrOverwriteAndNilSource 36 | } 37 | return nil 38 | } 39 | 40 | func (f FileEmbedded1) IgnoreDuplicates() map[string]struct{} { 41 | return map[string]struct{}{ 42 | "Append": {}, 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_3/types/ignition.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "github.com/coreos/go-semver/semver" 19 | 20 | "github.com/coreos/ignition/v2/config/shared/errors" 21 | 22 | "github.com/coreos/vcontext/path" 23 | "github.com/coreos/vcontext/report" 24 | ) 25 | 26 | func (v Ignition) Semver() (*semver.Version, error) { 27 | return semver.NewVersion(v.Version) 28 | } 29 | 30 | func (ic IgnitionConfig) Validate(c path.ContextPath) (r report.Report) { 31 | for i, res := range ic.Merge { 32 | r.AddOnError(c.Append("merge", i), res.validateRequiredSource()) 33 | } 34 | return 35 | } 36 | 37 | func (v Ignition) Validate(c path.ContextPath) (r report.Report) { 38 | c = c.Append("version") 39 | tv, err := v.Semver() 40 | if err != nil { 41 | r.AddOnError(c, errors.ErrInvalidVersion) 42 | return 43 | } 44 | 45 | if MaxVersion != *tv { 46 | r.AddOnError(c, errors.ErrUnknownVersion) 47 | } 48 | return 49 | } 50 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_3/types/kargs.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | func (k KernelArguments) MergedKeys() map[string]string { 18 | return map[string]string{ 19 | "ShouldExist": "KernelArgument", 20 | "ShouldNotExist": "KernelArgument", 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_3/types/mode.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "github.com/coreos/ignition/v2/config/shared/errors" 19 | ) 20 | 21 | func validateMode(m *int) error { 22 | if m != nil && (*m < 0 || *m > 07777) { 23 | return errors.ErrFileIllegalMode 24 | } 25 | return nil 26 | } 27 | 28 | func validateModeSpecialBits(m *int) error { 29 | if m != nil { 30 | mode := uint32(*m) 31 | if mode&07000 != 0 { 32 | return errors.ErrModeSpecialBits 33 | } 34 | } 35 | return nil 36 | } 37 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_3/types/passwd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | func (p PasswdUser) Key() string { 18 | return p.Name 19 | } 20 | 21 | func (g PasswdGroup) Key() string { 22 | return g.Name 23 | } 24 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_3/types/path.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "path" 19 | 20 | "github.com/coreos/ignition/v2/config/shared/errors" 21 | "github.com/coreos/ignition/v2/config/util" 22 | ) 23 | 24 | func validatePath(p string) error { 25 | if p == "" { 26 | return errors.ErrNoPath 27 | } 28 | if !path.IsAbs(p) { 29 | return errors.ErrPathRelative 30 | } 31 | if path.Clean(p) != p { 32 | return errors.ErrDirtyPath 33 | } 34 | return nil 35 | } 36 | 37 | func validatePathNilOK(p *string) error { 38 | if util.NilOrEmpty(p) { 39 | return nil 40 | } 41 | return validatePath(*p) 42 | } 43 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_3/types/proxy.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "net/url" 19 | 20 | "github.com/coreos/ignition/v2/config/shared/errors" 21 | 22 | "github.com/coreos/vcontext/path" 23 | "github.com/coreos/vcontext/report" 24 | ) 25 | 26 | func (p Proxy) Validate(c path.ContextPath) (r report.Report) { 27 | validateProxyURL(p.HTTPProxy, c.Append("httpProxy"), &r, true) 28 | validateProxyURL(p.HTTPSProxy, c.Append("httpsProxy"), &r, false) 29 | return 30 | } 31 | 32 | func validateProxyURL(s *string, p path.ContextPath, r *report.Report, httpOk bool) { 33 | if s == nil { 34 | return 35 | } 36 | u, err := url.Parse(*s) 37 | if err != nil { 38 | r.AddOnError(p, errors.ErrInvalidUrl) 39 | return 40 | } 41 | 42 | if u.Scheme != "https" && u.Scheme != "http" { 43 | r.AddOnError(p, errors.ErrInvalidProxy) 44 | return 45 | } 46 | if u.Scheme == "http" && !httpOk { 47 | r.AddOnWarn(p, errors.ErrInsecureProxy) 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_3/types/tang.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "net/url" 19 | 20 | "github.com/coreos/ignition/v2/config/shared/errors" 21 | "github.com/coreos/ignition/v2/config/util" 22 | 23 | "github.com/coreos/vcontext/path" 24 | "github.com/coreos/vcontext/report" 25 | ) 26 | 27 | func (t Tang) Key() string { 28 | return t.URL 29 | } 30 | 31 | func (t Tang) Validate(c path.ContextPath) (r report.Report) { 32 | r.AddOnError(c.Append("url"), validateTangURL(t.URL)) 33 | if util.NilOrEmpty(t.Thumbprint) { 34 | r.AddOnError(c.Append("thumbprint"), errors.ErrTangThumbprintRequired) 35 | } 36 | return 37 | } 38 | 39 | func validateTangURL(s string) error { 40 | u, err := url.Parse(s) 41 | if err != nil { 42 | return errors.ErrInvalidUrl 43 | } 44 | 45 | switch u.Scheme { 46 | case "http", "https": 47 | return nil 48 | default: 49 | return errors.ErrInvalidScheme 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_3/types/tls.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "github.com/coreos/vcontext/path" 19 | "github.com/coreos/vcontext/report" 20 | ) 21 | 22 | func (tls TLS) Validate(c path.ContextPath) (r report.Report) { 23 | for i, ca := range tls.CertificateAuthorities { 24 | r.AddOnError(c.Append("certificateAuthorities", i), ca.validateRequiredSource()) 25 | } 26 | return 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_3/types/url.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "net/url" 19 | 20 | "github.com/vincent-petithory/dataurl" 21 | 22 | "github.com/coreos/ignition/v2/config/shared/errors" 23 | "github.com/coreos/ignition/v2/config/util" 24 | ) 25 | 26 | func validateURL(s string) error { 27 | u, err := url.Parse(s) 28 | if err != nil { 29 | return errors.ErrInvalidUrl 30 | } 31 | 32 | switch u.Scheme { 33 | case "http", "https", "tftp", "gs": 34 | return nil 35 | case "s3": 36 | if v, ok := u.Query()["versionId"]; ok { 37 | if len(v) == 0 || v[0] == "" { 38 | return errors.ErrInvalidS3ObjectVersionId 39 | } 40 | } 41 | return nil 42 | case "data": 43 | if _, err := dataurl.DecodeString(s); err != nil { 44 | return err 45 | } 46 | return nil 47 | default: 48 | return errors.ErrInvalidScheme 49 | } 50 | } 51 | 52 | func validateURLNilOK(s *string) error { 53 | if util.NilOrEmpty(s) { 54 | return nil 55 | } 56 | return validateURL(*s) 57 | } 58 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_4/types/clevis.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "github.com/coreos/ignition/v2/config/shared/errors" 19 | "github.com/coreos/ignition/v2/config/util" 20 | 21 | "github.com/coreos/vcontext/path" 22 | "github.com/coreos/vcontext/report" 23 | ) 24 | 25 | func (c Clevis) IsPresent() bool { 26 | return util.NotEmpty(c.Custom.Pin) || 27 | len(c.Tang) > 0 || 28 | util.IsTrue(c.Tpm2) || 29 | c.Threshold != nil && *c.Threshold != 0 30 | } 31 | 32 | func (cu ClevisCustom) Validate(c path.ContextPath) (r report.Report) { 33 | if util.NilOrEmpty(cu.Pin) && util.NilOrEmpty(cu.Config) && !util.IsTrue(cu.NeedsNetwork) { 34 | return 35 | } 36 | if util.NotEmpty(cu.Pin) { 37 | switch *cu.Pin { 38 | case "tpm2", "tang", "sss": 39 | default: 40 | r.AddOnError(c.Append("pin"), errors.ErrUnknownClevisPin) 41 | } 42 | } else { 43 | r.AddOnError(c.Append("pin"), errors.ErrClevisPinRequired) 44 | } 45 | if util.NilOrEmpty(cu.Config) { 46 | r.AddOnError(c.Append("config"), errors.ErrClevisConfigRequired) 47 | } 48 | return 49 | } 50 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_4/types/device.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "github.com/coreos/vcontext/path" 19 | "github.com/coreos/vcontext/report" 20 | ) 21 | 22 | func (d Device) Validate(c path.ContextPath) (r report.Report) { 23 | r.AddOnError(c, validatePath(string(d))) 24 | return 25 | } 26 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_4/types/directory.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "github.com/coreos/vcontext/path" 19 | "github.com/coreos/vcontext/report" 20 | ) 21 | 22 | func (d Directory) Validate(c path.ContextPath) (r report.Report) { 23 | r.Merge(d.Node.Validate(c)) 24 | r.AddOnError(c.Append("mode"), validateMode(d.Mode)) 25 | return 26 | } 27 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_4/types/file.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "github.com/coreos/ignition/v2/config/shared/errors" 19 | "github.com/coreos/ignition/v2/config/util" 20 | 21 | "github.com/coreos/vcontext/path" 22 | "github.com/coreos/vcontext/report" 23 | ) 24 | 25 | func (f File) Validate(c path.ContextPath) (r report.Report) { 26 | r.Merge(f.Node.Validate(c)) 27 | r.AddOnError(c.Append("mode"), validateMode(f.Mode)) 28 | r.AddOnError(c.Append("overwrite"), f.validateOverwrite()) 29 | return 30 | } 31 | 32 | func (f File) validateOverwrite() error { 33 | if util.IsTrue(f.Overwrite) && f.Contents.Source == nil { 34 | return errors.ErrOverwriteAndNilSource 35 | } 36 | return nil 37 | } 38 | 39 | func (f FileEmbedded1) IgnoreDuplicates() map[string]struct{} { 40 | return map[string]struct{}{ 41 | "Append": {}, 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_4/types/ignition.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "github.com/coreos/go-semver/semver" 19 | 20 | "github.com/coreos/ignition/v2/config/shared/errors" 21 | 22 | "github.com/coreos/vcontext/path" 23 | "github.com/coreos/vcontext/report" 24 | ) 25 | 26 | func (v Ignition) Semver() (*semver.Version, error) { 27 | return semver.NewVersion(v.Version) 28 | } 29 | 30 | func (ic IgnitionConfig) Validate(c path.ContextPath) (r report.Report) { 31 | for i, res := range ic.Merge { 32 | r.AddOnError(c.Append("merge", i), res.validateRequiredSource()) 33 | } 34 | return 35 | } 36 | 37 | func (v Ignition) Validate(c path.ContextPath) (r report.Report) { 38 | c = c.Append("version") 39 | tv, err := v.Semver() 40 | if err != nil { 41 | r.AddOnError(c, errors.ErrInvalidVersion) 42 | return 43 | } 44 | 45 | if MaxVersion != *tv { 46 | r.AddOnError(c, errors.ErrUnknownVersion) 47 | } 48 | return 49 | } 50 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_4/types/kargs.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | func (k KernelArguments) MergedKeys() map[string]string { 18 | return map[string]string{ 19 | "ShouldExist": "KernelArgument", 20 | "ShouldNotExist": "KernelArgument", 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_4/types/mode.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "github.com/coreos/ignition/v2/config/shared/errors" 19 | ) 20 | 21 | func validateMode(m *int) error { 22 | if m != nil && (*m < 0 || *m > 07777) { 23 | return errors.ErrFileIllegalMode 24 | } 25 | return nil 26 | } 27 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_4/types/passwd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | func (p PasswdUser) Key() string { 18 | return p.Name 19 | } 20 | 21 | func (g PasswdGroup) Key() string { 22 | return g.Name 23 | } 24 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_4/types/path.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "path" 19 | 20 | "github.com/coreos/ignition/v2/config/shared/errors" 21 | "github.com/coreos/ignition/v2/config/util" 22 | ) 23 | 24 | func validatePath(p string) error { 25 | if p == "" { 26 | return errors.ErrNoPath 27 | } 28 | if !path.IsAbs(p) { 29 | return errors.ErrPathRelative 30 | } 31 | if path.Clean(p) != p { 32 | return errors.ErrDirtyPath 33 | } 34 | return nil 35 | } 36 | 37 | func validatePathNilOK(p *string) error { 38 | if util.NilOrEmpty(p) { 39 | return nil 40 | } 41 | return validatePath(*p) 42 | } 43 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_4/types/proxy.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "net/url" 19 | 20 | "github.com/coreos/ignition/v2/config/shared/errors" 21 | 22 | "github.com/coreos/vcontext/path" 23 | "github.com/coreos/vcontext/report" 24 | ) 25 | 26 | func (p Proxy) Validate(c path.ContextPath) (r report.Report) { 27 | validateProxyURL(p.HTTPProxy, c.Append("httpProxy"), &r, true) 28 | validateProxyURL(p.HTTPSProxy, c.Append("httpsProxy"), &r, false) 29 | return 30 | } 31 | 32 | func validateProxyURL(s *string, p path.ContextPath, r *report.Report, httpOk bool) { 33 | if s == nil { 34 | return 35 | } 36 | u, err := url.Parse(*s) 37 | if err != nil { 38 | r.AddOnError(p, errors.ErrInvalidUrl) 39 | return 40 | } 41 | 42 | if u.Scheme != "https" && u.Scheme != "http" { 43 | r.AddOnError(p, errors.ErrInvalidProxy) 44 | return 45 | } 46 | if u.Scheme == "http" && !httpOk { 47 | r.AddOnWarn(p, errors.ErrInsecureProxy) 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_4/types/tls.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "github.com/coreos/vcontext/path" 19 | "github.com/coreos/vcontext/report" 20 | ) 21 | 22 | func (tls TLS) Validate(c path.ContextPath) (r report.Report) { 23 | for i, ca := range tls.CertificateAuthorities { 24 | r.AddOnError(c.Append("certificateAuthorities", i), ca.validateRequiredSource()) 25 | } 26 | return 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_5/types/cex.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "github.com/coreos/ignition/v2/config/util" 19 | 20 | "github.com/coreos/vcontext/path" 21 | "github.com/coreos/vcontext/report" 22 | ) 23 | 24 | func (cm Cex) IsPresent() bool { 25 | return util.IsTrue(cm.Enabled) 26 | } 27 | 28 | func (cx Cex) Validate(c path.ContextPath) (r report.Report) { 29 | if !util.IsTrue(cx.Enabled) { 30 | return 31 | } 32 | return 33 | } 34 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_5/types/clevis.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "github.com/coreos/ignition/v2/config/shared/errors" 19 | "github.com/coreos/ignition/v2/config/util" 20 | 21 | "github.com/coreos/vcontext/path" 22 | "github.com/coreos/vcontext/report" 23 | ) 24 | 25 | func (c Clevis) IsPresent() bool { 26 | return util.NotEmpty(c.Custom.Pin) || 27 | len(c.Tang) > 0 || 28 | util.IsTrue(c.Tpm2) || 29 | c.Threshold != nil && *c.Threshold != 0 30 | } 31 | 32 | func (cu ClevisCustom) Validate(c path.ContextPath) (r report.Report) { 33 | if util.NilOrEmpty(cu.Pin) && util.NilOrEmpty(cu.Config) && !util.IsTrue(cu.NeedsNetwork) { 34 | return 35 | } 36 | if util.NotEmpty(cu.Pin) { 37 | switch *cu.Pin { 38 | case "tpm2", "tang", "sss": 39 | default: 40 | r.AddOnError(c.Append("pin"), errors.ErrUnknownClevisPin) 41 | } 42 | } else { 43 | r.AddOnError(c.Append("pin"), errors.ErrClevisPinRequired) 44 | } 45 | if util.NilOrEmpty(cu.Config) { 46 | r.AddOnError(c.Append("config"), errors.ErrClevisConfigRequired) 47 | } 48 | return 49 | } 50 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_5/types/device.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "github.com/coreos/vcontext/path" 19 | "github.com/coreos/vcontext/report" 20 | ) 21 | 22 | func (d Device) Validate(c path.ContextPath) (r report.Report) { 23 | r.AddOnError(c, validatePath(string(d))) 24 | return 25 | } 26 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_5/types/directory.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "github.com/coreos/vcontext/path" 19 | "github.com/coreos/vcontext/report" 20 | ) 21 | 22 | func (d Directory) Validate(c path.ContextPath) (r report.Report) { 23 | r.Merge(d.Node.Validate(c)) 24 | r.AddOnError(c.Append("mode"), validateMode(d.Mode)) 25 | return 26 | } 27 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_5/types/file.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "github.com/coreos/ignition/v2/config/shared/errors" 19 | "github.com/coreos/ignition/v2/config/util" 20 | 21 | "github.com/coreos/vcontext/path" 22 | "github.com/coreos/vcontext/report" 23 | ) 24 | 25 | func (f File) Validate(c path.ContextPath) (r report.Report) { 26 | r.Merge(f.Node.Validate(c)) 27 | r.AddOnError(c.Append("mode"), validateMode(f.Mode)) 28 | r.AddOnError(c.Append("overwrite"), f.validateOverwrite()) 29 | return 30 | } 31 | 32 | func (f File) validateOverwrite() error { 33 | if util.IsTrue(f.Overwrite) && f.Contents.Source == nil { 34 | return errors.ErrOverwriteAndNilSource 35 | } 36 | return nil 37 | } 38 | 39 | func (f FileEmbedded1) IgnoreDuplicates() map[string]struct{} { 40 | return map[string]struct{}{ 41 | "Append": {}, 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_5/types/ignition.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "github.com/coreos/go-semver/semver" 19 | 20 | "github.com/coreos/ignition/v2/config/shared/errors" 21 | 22 | "github.com/coreos/vcontext/path" 23 | "github.com/coreos/vcontext/report" 24 | ) 25 | 26 | func (v Ignition) Semver() (*semver.Version, error) { 27 | return semver.NewVersion(v.Version) 28 | } 29 | 30 | func (ic IgnitionConfig) Validate(c path.ContextPath) (r report.Report) { 31 | for i, res := range ic.Merge { 32 | r.AddOnError(c.Append("merge", i), res.validateRequiredSource()) 33 | } 34 | return 35 | } 36 | 37 | func (v Ignition) Validate(c path.ContextPath) (r report.Report) { 38 | c = c.Append("version") 39 | tv, err := v.Semver() 40 | if err != nil { 41 | r.AddOnError(c, errors.ErrInvalidVersion) 42 | return 43 | } 44 | 45 | if MaxVersion != *tv { 46 | r.AddOnError(c, errors.ErrUnknownVersion) 47 | } 48 | return 49 | } 50 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_5/types/kargs.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | func (k KernelArguments) MergedKeys() map[string]string { 18 | return map[string]string{ 19 | "ShouldExist": "KernelArgument", 20 | "ShouldNotExist": "KernelArgument", 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_5/types/mode.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "github.com/coreos/ignition/v2/config/shared/errors" 19 | ) 20 | 21 | func validateMode(m *int) error { 22 | if m != nil && (*m < 0 || *m > 07777) { 23 | return errors.ErrFileIllegalMode 24 | } 25 | return nil 26 | } 27 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_5/types/passwd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | func (p PasswdUser) Key() string { 18 | return p.Name 19 | } 20 | 21 | func (g PasswdGroup) Key() string { 22 | return g.Name 23 | } 24 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_5/types/path.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "path" 19 | 20 | "github.com/coreos/ignition/v2/config/shared/errors" 21 | "github.com/coreos/ignition/v2/config/util" 22 | ) 23 | 24 | func validatePath(p string) error { 25 | if p == "" { 26 | return errors.ErrNoPath 27 | } 28 | if !path.IsAbs(p) { 29 | return errors.ErrPathRelative 30 | } 31 | if path.Clean(p) != p { 32 | return errors.ErrDirtyPath 33 | } 34 | return nil 35 | } 36 | 37 | func validatePathNilOK(p *string) error { 38 | if util.NilOrEmpty(p) { 39 | return nil 40 | } 41 | return validatePath(*p) 42 | } 43 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_5/types/proxy.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "net/url" 19 | 20 | "github.com/coreos/ignition/v2/config/shared/errors" 21 | 22 | "github.com/coreos/vcontext/path" 23 | "github.com/coreos/vcontext/report" 24 | ) 25 | 26 | func (p Proxy) Validate(c path.ContextPath) (r report.Report) { 27 | validateProxyURL(p.HTTPProxy, c.Append("httpProxy"), &r, true) 28 | validateProxyURL(p.HTTPSProxy, c.Append("httpsProxy"), &r, false) 29 | return 30 | } 31 | 32 | func validateProxyURL(s *string, p path.ContextPath, r *report.Report, httpOk bool) { 33 | if s == nil { 34 | return 35 | } 36 | u, err := url.Parse(*s) 37 | if err != nil { 38 | r.AddOnError(p, errors.ErrInvalidUrl) 39 | return 40 | } 41 | 42 | if u.Scheme != "https" && u.Scheme != "http" { 43 | r.AddOnError(p, errors.ErrInvalidProxy) 44 | return 45 | } 46 | if u.Scheme == "http" && !httpOk { 47 | r.AddOnWarn(p, errors.ErrInsecureProxy) 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_5/types/tls.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "github.com/coreos/vcontext/path" 19 | "github.com/coreos/vcontext/report" 20 | ) 21 | 22 | func (tls TLS) Validate(c path.ContextPath) (r report.Report) { 23 | for i, ca := range tls.CertificateAuthorities { 24 | r.AddOnError(c.Append("certificateAuthorities", i), ca.validateRequiredSource()) 25 | } 26 | return 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_6_experimental/types/cex.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "github.com/coreos/ignition/v2/config/util" 19 | 20 | "github.com/coreos/vcontext/path" 21 | "github.com/coreos/vcontext/report" 22 | ) 23 | 24 | func (cm Cex) IsPresent() bool { 25 | return util.IsTrue(cm.Enabled) 26 | } 27 | 28 | func (cx Cex) Validate(c path.ContextPath) (r report.Report) { 29 | if !util.IsTrue(cx.Enabled) { 30 | return 31 | } 32 | return 33 | } 34 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_6_experimental/types/device.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "github.com/coreos/vcontext/path" 19 | "github.com/coreos/vcontext/report" 20 | ) 21 | 22 | func (d Device) Validate(c path.ContextPath) (r report.Report) { 23 | r.AddOnError(c, validatePath(string(d))) 24 | return 25 | } 26 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_6_experimental/types/directory.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "github.com/coreos/vcontext/path" 19 | "github.com/coreos/vcontext/report" 20 | ) 21 | 22 | func (d Directory) Validate(c path.ContextPath) (r report.Report) { 23 | r.Merge(d.Node.Validate(c)) 24 | r.AddOnError(c.Append("mode"), validateMode(d.Mode)) 25 | return 26 | } 27 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_6_experimental/types/file.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "github.com/coreos/ignition/v2/config/shared/errors" 19 | "github.com/coreos/ignition/v2/config/util" 20 | 21 | "github.com/coreos/vcontext/path" 22 | "github.com/coreos/vcontext/report" 23 | ) 24 | 25 | func (f File) Validate(c path.ContextPath) (r report.Report) { 26 | r.Merge(f.Node.Validate(c)) 27 | r.AddOnError(c.Append("mode"), validateMode(f.Mode)) 28 | r.AddOnError(c.Append("overwrite"), f.validateOverwrite()) 29 | return 30 | } 31 | 32 | func (f File) validateOverwrite() error { 33 | if util.IsTrue(f.Overwrite) && f.Contents.Source == nil { 34 | return errors.ErrOverwriteAndNilSource 35 | } 36 | return nil 37 | } 38 | 39 | func (f FileEmbedded1) IgnoreDuplicates() map[string]struct{} { 40 | return map[string]struct{}{ 41 | "Append": {}, 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_6_experimental/types/ignition.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "github.com/coreos/go-semver/semver" 19 | 20 | "github.com/coreos/ignition/v2/config/shared/errors" 21 | 22 | "github.com/coreos/vcontext/path" 23 | "github.com/coreos/vcontext/report" 24 | ) 25 | 26 | func (v Ignition) Semver() (*semver.Version, error) { 27 | return semver.NewVersion(v.Version) 28 | } 29 | 30 | func (ic IgnitionConfig) Validate(c path.ContextPath) (r report.Report) { 31 | for i, res := range ic.Merge { 32 | r.AddOnError(c.Append("merge", i), res.validateRequiredSource()) 33 | } 34 | return 35 | } 36 | 37 | func (v Ignition) Validate(c path.ContextPath) (r report.Report) { 38 | c = c.Append("version") 39 | tv, err := v.Semver() 40 | if err != nil { 41 | r.AddOnError(c, errors.ErrInvalidVersion) 42 | return 43 | } 44 | 45 | if MaxVersion != *tv { 46 | r.AddOnError(c, errors.ErrUnknownVersion) 47 | } 48 | return 49 | } 50 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_6_experimental/types/kargs.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | func (k KernelArguments) MergedKeys() map[string]string { 18 | return map[string]string{ 19 | "ShouldExist": "KernelArgument", 20 | "ShouldNotExist": "KernelArgument", 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_6_experimental/types/mode.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "github.com/coreos/ignition/v2/config/shared/errors" 19 | ) 20 | 21 | func validateMode(m *int) error { 22 | if m != nil && (*m < 0 || *m > 07777) { 23 | return errors.ErrFileIllegalMode 24 | } 25 | return nil 26 | } 27 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_6_experimental/types/passwd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | func (p PasswdUser) Key() string { 18 | return p.Name 19 | } 20 | 21 | func (g PasswdGroup) Key() string { 22 | return g.Name 23 | } 24 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_6_experimental/types/path.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "path" 19 | 20 | "github.com/coreos/ignition/v2/config/shared/errors" 21 | "github.com/coreos/ignition/v2/config/util" 22 | ) 23 | 24 | func validatePath(p string) error { 25 | if p == "" { 26 | return errors.ErrNoPath 27 | } 28 | if !path.IsAbs(p) { 29 | return errors.ErrPathRelative 30 | } 31 | if path.Clean(p) != p { 32 | return errors.ErrDirtyPath 33 | } 34 | return nil 35 | } 36 | 37 | func validatePathNilOK(p *string) error { 38 | if util.NilOrEmpty(p) { 39 | return nil 40 | } 41 | return validatePath(*p) 42 | } 43 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_6_experimental/types/proxy.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "net/url" 19 | 20 | "github.com/coreos/ignition/v2/config/shared/errors" 21 | 22 | "github.com/coreos/vcontext/path" 23 | "github.com/coreos/vcontext/report" 24 | ) 25 | 26 | func (p Proxy) Validate(c path.ContextPath) (r report.Report) { 27 | validateProxyURL(p.HTTPProxy, c.Append("httpProxy"), &r, true) 28 | validateProxyURL(p.HTTPSProxy, c.Append("httpsProxy"), &r, false) 29 | return 30 | } 31 | 32 | func validateProxyURL(s *string, p path.ContextPath, r *report.Report, httpOk bool) { 33 | if s == nil { 34 | return 35 | } 36 | u, err := url.Parse(*s) 37 | if err != nil { 38 | r.AddOnError(p, errors.ErrInvalidUrl) 39 | return 40 | } 41 | 42 | if u.Scheme != "https" && u.Scheme != "http" { 43 | r.AddOnError(p, errors.ErrInvalidProxy) 44 | return 45 | } 46 | if u.Scheme == "http" && !httpOk { 47 | r.AddOnWarn(p, errors.ErrInsecureProxy) 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/ignition/v2/config/v3_6_experimental/types/tls.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Red Hat, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "github.com/coreos/vcontext/path" 19 | "github.com/coreos/vcontext/report" 20 | ) 21 | 22 | func (tls TLS) Validate(c path.ContextPath) (r report.Report) { 23 | for i, ca := range tls.CertificateAuthorities { 24 | r.AddOnError(c.Append("certificateAuthorities", i), ca.validateRequiredSource()) 25 | } 26 | return 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/davecgh/go-spew/LICENSE: -------------------------------------------------------------------------------- 1 | ISC License 2 | 3 | Copyright (c) 2012-2016 Dave Collins 4 | 5 | Permission to use, copy, modify, and/or distribute this software for any 6 | purpose with or without fee is hereby granted, provided that the above 7 | copyright notice and this permission notice appear in all copies. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/copystructure/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Mitchell Hashimoto 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/copystructure/README.md: -------------------------------------------------------------------------------- 1 | # copystructure 2 | 3 | copystructure is a Go library for deep copying values in Go. 4 | 5 | This allows you to copy Go values that may contain reference values 6 | such as maps, slices, or pointers, and copy their data as well instead 7 | of just their references. 8 | 9 | ## Installation 10 | 11 | Standard `go get`: 12 | 13 | ``` 14 | $ go get github.com/mitchellh/copystructure 15 | ``` 16 | 17 | ## Usage & Example 18 | 19 | For usage and examples see the [Godoc](http://godoc.org/github.com/mitchellh/copystructure). 20 | 21 | The `Copy` function has examples associated with it there. 22 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/copystructure/copier_time.go: -------------------------------------------------------------------------------- 1 | package copystructure 2 | 3 | import ( 4 | "reflect" 5 | "time" 6 | ) 7 | 8 | func init() { 9 | Copiers[reflect.TypeOf(time.Time{})] = timeCopier 10 | } 11 | 12 | func timeCopier(v interface{}) (interface{}, error) { 13 | // Just... copy it. 14 | return v.(time.Time), nil 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/reflectwalk/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/reflectwalk/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 Mitchell Hashimoto 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/reflectwalk/README.md: -------------------------------------------------------------------------------- 1 | # reflectwalk 2 | 3 | reflectwalk is a Go library for "walking" a value in Go using reflection, 4 | in the same way a directory tree can be "walked" on the filesystem. Walking 5 | a complex structure can allow you to do manipulations on unknown structures 6 | such as those decoded from JSON. 7 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/reflectwalk/location.go: -------------------------------------------------------------------------------- 1 | package reflectwalk 2 | 3 | //go:generate stringer -type=Location location.go 4 | 5 | type Location uint 6 | 7 | const ( 8 | None Location = iota 9 | Map 10 | MapKey 11 | MapValue 12 | Slice 13 | SliceElem 14 | Array 15 | ArrayElem 16 | Struct 17 | StructField 18 | WalkLoc 19 | ) 20 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/reflectwalk/location_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=Location location.go"; DO NOT EDIT. 2 | 3 | package reflectwalk 4 | 5 | import "fmt" 6 | 7 | const _Location_name = "NoneMapMapKeyMapValueSliceSliceElemArrayArrayElemStructStructFieldWalkLoc" 8 | 9 | var _Location_index = [...]uint8{0, 4, 7, 13, 21, 26, 35, 40, 49, 55, 66, 73} 10 | 11 | func (i Location) String() string { 12 | if i >= Location(len(_Location_index)-1) { 13 | return fmt.Sprintf("Location(%d)", i) 14 | } 15 | return _Location_name[_Location_index[i]:_Location_index[i+1]] 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/pmezard/go-difflib/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013, Patrick Mezard 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | The names of its contributors may not be used to endorse or promote 14 | products derived from this software without specific prior written 15 | permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 18 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 19 | TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 20 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 23 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 24 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 25 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 26 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/pflag/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | indent_size = 4 7 | indent_style = space 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.go] 12 | indent_style = tab 13 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/pflag/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/* 2 | 3 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/pflag/.golangci.yaml: -------------------------------------------------------------------------------- 1 | linters: 2 | disable-all: true 3 | enable: 4 | - nolintlint 5 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/pflag/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | 3 | language: go 4 | 5 | go: 6 | - 1.9.x 7 | - 1.10.x 8 | - 1.11.x 9 | - tip 10 | 11 | matrix: 12 | allow_failures: 13 | - go: tip 14 | 15 | install: 16 | - go get golang.org/x/lint/golint 17 | - export PATH=$GOPATH/bin:$PATH 18 | - go install ./... 19 | 20 | script: 21 | - verify/all.sh -v 22 | - go test ./... 23 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/pflag/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 Alex Ogier. All rights reserved. 2 | Copyright (c) 2012 The Go Authors. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above 11 | copyright notice, this list of conditions and the following disclaimer 12 | in the documentation and/or other materials provided with the 13 | distribution. 14 | * Neither the name of Google Inc. nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2012-2020 Mat Ryer, Tyler Bunnell and contributors. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/assert/assertion_format.go.tmpl: -------------------------------------------------------------------------------- 1 | {{.CommentFormat}} 2 | func {{.DocInfo.Name}}f(t TestingT, {{.ParamsFormat}}) bool { 3 | if h, ok := t.(tHelper); ok { h.Helper() } 4 | return {{.DocInfo.Name}}(t, {{.ForwardedParamsFormat}}) 5 | } 6 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/assert/assertion_forward.go.tmpl: -------------------------------------------------------------------------------- 1 | {{.CommentWithoutT "a"}} 2 | func (a *Assertions) {{.DocInfo.Name}}({{.Params}}) bool { 3 | if h, ok := a.t.(tHelper); ok { h.Helper() } 4 | return {{.DocInfo.Name}}(a.t, {{.ForwardedParams}}) 5 | } 6 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/assert/doc.go: -------------------------------------------------------------------------------- 1 | // Package assert provides a set of comprehensive testing tools for use with the normal Go testing system. 2 | // 3 | // # Example Usage 4 | // 5 | // The following is a complete example using assert in a standard test function: 6 | // 7 | // import ( 8 | // "testing" 9 | // "github.com/stretchr/testify/assert" 10 | // ) 11 | // 12 | // func TestSomething(t *testing.T) { 13 | // 14 | // var a string = "Hello" 15 | // var b string = "Hello" 16 | // 17 | // assert.Equal(t, a, b, "The two words should be the same.") 18 | // 19 | // } 20 | // 21 | // if you assert many times, use the format below: 22 | // 23 | // import ( 24 | // "testing" 25 | // "github.com/stretchr/testify/assert" 26 | // ) 27 | // 28 | // func TestSomething(t *testing.T) { 29 | // assert := assert.New(t) 30 | // 31 | // var a string = "Hello" 32 | // var b string = "Hello" 33 | // 34 | // assert.Equal(a, b, "The two words should be the same.") 35 | // } 36 | // 37 | // # Assertions 38 | // 39 | // Assertions allow you to easily write test code, and are global funcs in the `assert` package. 40 | // All assertion functions take, as the first argument, the `*testing.T` object provided by the 41 | // testing framework. This allows the assertion funcs to write the failings and other details to 42 | // the correct place. 43 | // 44 | // Every assertion function also takes an optional string message as the final argument, 45 | // allowing custom error messages to be appended to the message the assertion method outputs. 46 | package assert 47 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/assert/errors.go: -------------------------------------------------------------------------------- 1 | package assert 2 | 3 | import ( 4 | "errors" 5 | ) 6 | 7 | // AnError is an error instance useful for testing. If the code does not care 8 | // about error specifics, and only needs to return the error for example, this 9 | // error should be used to make the test code more readable. 10 | var AnError = errors.New("assert.AnError general error for testing") 11 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/assert/forward_assertions.go: -------------------------------------------------------------------------------- 1 | package assert 2 | 3 | // Assertions provides assertion methods around the 4 | // TestingT interface. 5 | type Assertions struct { 6 | t TestingT 7 | } 8 | 9 | // New makes a new Assertions object for the specified TestingT. 10 | func New(t TestingT) *Assertions { 11 | return &Assertions{ 12 | t: t, 13 | } 14 | } 15 | 16 | //go:generate sh -c "cd ../_codegen && go build && cd - && ../_codegen/_codegen -output-package=assert -template=assertion_forward.go.tmpl -include-format-funcs" 17 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/assert/yaml/yaml_custom.go: -------------------------------------------------------------------------------- 1 | //go:build testify_yaml_custom && !testify_yaml_fail && !testify_yaml_default 2 | // +build testify_yaml_custom,!testify_yaml_fail,!testify_yaml_default 3 | 4 | // Package yaml is an implementation of YAML functions that calls a pluggable implementation. 5 | // 6 | // This implementation is selected with the testify_yaml_custom build tag. 7 | // 8 | // go test -tags testify_yaml_custom 9 | // 10 | // This implementation can be used at build time to replace the default implementation 11 | // to avoid linking with [gopkg.in/yaml.v3]. 12 | // 13 | // In your test package: 14 | // 15 | // import assertYaml "github.com/stretchr/testify/assert/yaml" 16 | // 17 | // func init() { 18 | // assertYaml.Unmarshal = func (in []byte, out interface{}) error { 19 | // // ... 20 | // return nil 21 | // } 22 | // } 23 | package yaml 24 | 25 | var Unmarshal func(in []byte, out interface{}) error 26 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/assert/yaml/yaml_fail.go: -------------------------------------------------------------------------------- 1 | //go:build testify_yaml_fail && !testify_yaml_custom && !testify_yaml_default 2 | // +build testify_yaml_fail,!testify_yaml_custom,!testify_yaml_default 3 | 4 | // Package yaml is an implementation of YAML functions that always fail. 5 | // 6 | // This implementation can be used at build time to replace the default implementation 7 | // to avoid linking with [gopkg.in/yaml.v3]: 8 | // 9 | // go test -tags testify_yaml_fail 10 | package yaml 11 | 12 | import "errors" 13 | 14 | var errNotImplemented = errors.New("YAML functions are not available (see https://pkg.go.dev/github.com/stretchr/testify/assert/yaml)") 15 | 16 | func Unmarshal([]byte, interface{}) error { 17 | return errNotImplemented 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/vincent-petithory/dataurl/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Vincent Petithory 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /vendor/github.com/vincent-petithory/dataurl/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package dataurl parses Data URL Schemes 3 | according to RFC 2397 4 | (http://tools.ietf.org/html/rfc2397). 5 | 6 | Data URLs are small chunks of data commonly used in browsers to display inline data, 7 | typically like small images, or when you use the FileReader API of the browser. 8 | 9 | A dataurl looks like: 10 | 11 | data:text/plain;charset=utf-8,A%20brief%20note 12 | 13 | Or, with base64 encoding: 14 | 15 | data:image/vnd.microsoft.icon;name=golang%20favicon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAA 16 | AAAAAAD///8AVE44//7hdv/+4Xb//uF2//7hdv/+4Xb//uF2//7hdv/+4Xb//uF2//7hdv/+4Xb/ 17 | /uF2/1ROOP////8A////AFROOP/+4Xb//uF2//7hdv/+4Xb//uF2//7hdv/+4Xb//uF2//7hdv/+ 18 | ... 19 | /6CcjP97c07/e3NO/1dOMf9BOiX/TkUn/2VXLf97c07/e3NO/6CcjP/h4uX/////AP///wD///8A 20 | ////AP///wD///8A////AP///wDq6/H/3N/j/9fZ3f/q6/H/////AP///wD///8A////AP///wD/ 21 | //8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 22 | AAAAAAAAAAAAAA== 23 | 24 | Common functions are Decode and DecodeString to obtain a DataURL, 25 | and DataURL.String() and DataURL.WriteTo to generate a Data URL string. 26 | 27 | */ 28 | package dataurl 29 | -------------------------------------------------------------------------------- /vendor/github.com/vincent-petithory/dataurl/wercker.yml: -------------------------------------------------------------------------------- 1 | box: wercker/default -------------------------------------------------------------------------------- /vendor/gopkg.in/yaml.v3/NOTICE: -------------------------------------------------------------------------------- 1 | Copyright 2011-2016 Canonical Ltd. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | --------------------------------------------------------------------------------