mirror of
https://github.com/kairos-io/kairos-agent.git
synced 2025-08-19 08:47:03 +00:00
Split yip config dirs from user config dirs
as per the comment here: https://github.com/kairos-io/kairos-agent/pull/550#discussion_r1776759001 Signed-off-by: Dimitris Karakasilis <dimitris@karakasilis.me>
This commit is contained in:
parent
99e8509065
commit
d618ff72f3
20
main.go
20
main.go
@ -198,7 +198,7 @@ See https://kairos.io/docs/upgrade/manual/ for documentation.
|
|||||||
}
|
}
|
||||||
|
|
||||||
return agent.Upgrade(source, c.Bool("force"),
|
return agent.Upgrade(source, c.Bool("force"),
|
||||||
c.Bool("strict-validation"), constants.GetConfigScanDirs(),
|
c.Bool("strict-validation"), constants.GetUserConfigDirs(),
|
||||||
upgradeEntry, c.Bool("pre"),
|
upgradeEntry, c.Bool("pre"),
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
@ -327,7 +327,7 @@ E.g. kairos-agent install-bundle container:quay.io/kairos/kairos...
|
|||||||
Description: "Show the runtime configuration of the machine. It will scan the machine for all the configuration and will return the config file processed and found.",
|
Description: "Show the runtime configuration of the machine. It will scan the machine for all the configuration and will return the config file processed and found.",
|
||||||
Aliases: []string{"c"},
|
Aliases: []string{"c"},
|
||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
config, err := agentConfig.Scan(collector.Directories(constants.GetConfigScanDirs()...), collector.NoLogs)
|
config, err := agentConfig.Scan(collector.Directories(constants.GetUserConfigDirs()...), collector.NoLogs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -346,7 +346,7 @@ E.g. kairos-agent install-bundle container:quay.io/kairos/kairos...
|
|||||||
Description: "WARNING this command will be deprecated in v3.2.0. Use `config` without a subcommand instead.\n\n Show the runtime configuration of the machine. It will scan the machine for all the configuration and will return the config file processed and found.",
|
Description: "WARNING this command will be deprecated in v3.2.0. Use `config` without a subcommand instead.\n\n Show the runtime configuration of the machine. It will scan the machine for all the configuration and will return the config file processed and found.",
|
||||||
Aliases: []string{},
|
Aliases: []string{},
|
||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
config, err := agentConfig.Scan(collector.Directories(constants.GetConfigScanDirs()...), collector.NoLogs)
|
config, err := agentConfig.Scan(collector.Directories(constants.GetUserConfigDirs()...), collector.NoLogs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -375,7 +375,7 @@ enabled: true`,
|
|||||||
Description: "It allows to navigate the YAML config file by searching with 'yq' style keywords as `config get k3s` to retrieve the k3s config block",
|
Description: "It allows to navigate the YAML config file by searching with 'yq' style keywords as `config get k3s` to retrieve the k3s config block",
|
||||||
Aliases: []string{"g"},
|
Aliases: []string{"g"},
|
||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
config, err := agentConfig.ScanNoLogs(collector.Directories(constants.GetConfigScanDirs()...), collector.NoLogs, collector.StrictValidation(c.Bool("strict-validation")))
|
config, err := agentConfig.ScanNoLogs(collector.Directories(constants.GetUserConfigDirs()...), collector.NoLogs, collector.StrictValidation(c.Bool("strict-validation")))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -446,7 +446,7 @@ enabled: true`,
|
|||||||
},
|
},
|
||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
|
|
||||||
config, err := agentConfig.ScanNoLogs(collector.Directories(constants.GetConfigScanDirs()...), collector.NoLogs, collector.StrictValidation(c.Bool("strict-validation")))
|
config, err := agentConfig.ScanNoLogs(collector.Directories(constants.GetUserConfigDirs()...), collector.NoLogs, collector.StrictValidation(c.Bool("strict-validation")))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -556,7 +556,7 @@ This command is meant to be used from the boot GRUB menu, but can be started man
|
|||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
source := c.String("source")
|
source := c.String("source")
|
||||||
|
|
||||||
return agent.Install(source, constants.GetConfigScanDirs()...)
|
return agent.Install(source, constants.GetUserConfigDirs()...)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -600,7 +600,7 @@ This command is meant to be used from the boot GRUB menu, but can likely be used
|
|||||||
unattended := c.Bool("unattended")
|
unattended := c.Bool("unattended")
|
||||||
resetOem := c.Bool("reset-oem")
|
resetOem := c.Bool("reset-oem")
|
||||||
|
|
||||||
return agent.Reset(reboot, unattended, resetOem, constants.GetConfigScanDirs()...)
|
return agent.Reset(reboot, unattended, resetOem, constants.GetUserConfigDirs()...)
|
||||||
},
|
},
|
||||||
Usage: "Starts kairos reset mode",
|
Usage: "Starts kairos reset mode",
|
||||||
Description: `
|
Description: `
|
||||||
@ -684,7 +684,7 @@ The validate command expects a configuration file as its only argument. Local fi
|
|||||||
},
|
},
|
||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
stage := c.Args().First()
|
stage := c.Args().First()
|
||||||
config, err := agentConfig.Scan(collector.Directories(constants.GetConfigScanDirs()...), collector.NoLogs)
|
config, err := agentConfig.Scan(collector.Directories(constants.GetYipConfigDirs()...), collector.NoLogs)
|
||||||
config.Strict = c.Bool("strict")
|
config.Strict = c.Bool("strict")
|
||||||
|
|
||||||
if len(c.StringSlice("cloud-init-paths")) > 0 {
|
if len(c.StringSlice("cloud-init-paths")) > 0 {
|
||||||
@ -730,7 +730,7 @@ The validate command expects a configuration file as its only argument. Local fi
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("invalid path %s", destination)
|
return fmt.Errorf("invalid path %s", destination)
|
||||||
}
|
}
|
||||||
config, err := agentConfig.Scan(collector.Directories(constants.GetConfigScanDirs()...), collector.NoLogs)
|
config, err := agentConfig.Scan(collector.Directories(constants.GetUserConfigDirs()...), collector.NoLogs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -784,7 +784,7 @@ The validate command expects a configuration file as its only argument. Local fi
|
|||||||
return checkRoot()
|
return checkRoot()
|
||||||
},
|
},
|
||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
cfg, err := agentConfig.Scan(collector.Directories(constants.GetConfigScanDirs()...), collector.NoLogs)
|
cfg, err := agentConfig.Scan(collector.Directories(constants.GetUserConfigDirs()...), collector.NoLogs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -169,10 +169,16 @@ func GetGrubModules() []string {
|
|||||||
return []string{"loopback.mod", "squash4.mod", "xzio.mod", "gzio.mod", "regexp.mod"}
|
return []string{"loopback.mod", "squash4.mod", "xzio.mod", "gzio.mod", "regexp.mod"}
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetConfigScanDirs() []string {
|
// GetYipConfigDirs returns all the directories where "yip" configuration might
|
||||||
|
// live. These include the directories were we store our system overlay files:
|
||||||
|
// https://github.com/kairos-io/packages/tree/main/packages/static/kairos-overlay-files/files/system/oem
|
||||||
|
func GetYipConfigDirs() []string {
|
||||||
|
return append(GetUserConfigDirs(), "/system/oem")
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetUserConfigDirs() []string {
|
||||||
return []string{
|
return []string{
|
||||||
"/oem",
|
"/oem",
|
||||||
"/system/oem",
|
|
||||||
"/usr/local/cloud-config",
|
"/usr/local/cloud-config",
|
||||||
"/run/initramfs/live",
|
"/run/initramfs/live",
|
||||||
"/etc/kairos", // Default system configuration file https://github.com/kairos-io/kairos/issues/2221
|
"/etc/kairos", // Default system configuration file https://github.com/kairos-io/kairos/issues/2221
|
||||||
|
Loading…
Reference in New Issue
Block a user