Skip to content

Commit 615c6eb

Browse files
kvapsclaude
andcommitted
feat: add -skip-validation flag
Allow bypassing the schema check so a user on a newer Talos version (with a config that uses fields this tool's schema does not yet know about) can still write META without waiting for the tool to bump its machinery dependency. Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
1 parent b0d7368 commit 615c6eb

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@ talos-meta-tool -device /dev/sda -config config.yaml
1818
The `-device` flag accepts the full disk (e.g. `/dev/sda`); the META partition is discovered automatically via GPT.
1919

2020
The `-config` file is validated against the Talos v1.13 metal network configuration schema (`network.PlatformConfigSpec`) before writing: unknown fields, malformed addresses and invalid enum values are rejected.
21+
22+
To bypass validation — e.g. when the config uses fields that a newer Talos version has added but this tool's schema does not yet know about — pass `-skip-validation`.

main.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ func writeConfig(dev interface{ io.ReaderAt; io.WriterAt }, configData []byte) e
9090
func main() {
9191
devicePath := flag.String("device", "", "Path to the disk device (e.g., /dev/sda)")
9292
configPath := flag.String("config", "", "Path to the configuration file (e.g., config.yaml)")
93+
skipValidation := flag.Bool("skip-validation", false, "Skip schema validation of the configuration file")
9394
flag.Parse()
9495

9596
if *devicePath == "" || *configPath == "" {
@@ -102,8 +103,10 @@ func main() {
102103
log.Fatalf("Error reading configuration file: %v", err)
103104
}
104105

105-
if err := validateConfig(configData); err != nil {
106-
log.Fatalf("Invalid network configuration: %v", err)
106+
if !*skipValidation {
107+
if err := validateConfig(configData); err != nil {
108+
log.Fatalf("Invalid network configuration: %v", err)
109+
}
107110
}
108111

109112
device, err := os.OpenFile(*devicePath, os.O_RDWR, 0)

0 commit comments

Comments
 (0)