Allow adding extra cloud-init paths to run-stage (#27)

This commit is contained in:
Itxaka
2023-05-18 16:23:18 +02:00
committed by GitHub
parent 8680b0ae93
commit f3d5965041
2 changed files with 9 additions and 1 deletions

View File

@@ -498,6 +498,10 @@ The validate command expects a configuration file as its only argument. Local fi
Name: "strict",
Usage: "Enable strict mode. Fails and exits on stage errors",
},
&cli.StringSliceFlag{
Name: "cloud-init-paths",
Usage: "Extra paths to add to the run stage",
},
},
Before: func(c *cli.Context) error {
if c.Args().Len() != 1 {
@@ -512,6 +516,10 @@ The validate command expects a configuration file as its only argument. Local fi
cfg, err := elementalConfig.ReadConfigRun("/etc/elemental")
cfg.Strict = c.Bool("strict")
if len(c.StringSlice("cloud-init-paths")) > 0 {
cfg.CloudInitPaths = append(cfg.CloudInitPaths, c.StringSlice("cloud-init-paths")...)
}
if err != nil {
cfg.Logger.Errorf("Error reading config: %s\n", err)
}