Fix a small issue with common flag (#796)

This commit is contained in:
Itxaka
2025-06-04 09:53:32 +02:00
committed by GitHub
parent 6ebe8909d4
commit 694a280959
3 changed files with 50 additions and 69 deletions

46
main.go
View File

@@ -855,11 +855,16 @@ The validate command expects a configuration file as its only argument. Local fi
}
var bootState string
if c.Bool("active") {
bootState = "active"
}
if c.Bool("passive") {
bootState = "passive"
for k, v := range map[string]bool{
"active": c.Bool("active"),
"passive": c.Bool("passive"),
"recovery": c.Bool("recovery"),
"common": c.Bool("common"),
} {
if v {
bootState = k
break
}
}
out, err := action.ListSystemExtensions(cfg, bootState)
if err != nil {
@@ -926,12 +931,18 @@ The validate command expects a configuration file as its only argument. Local fi
return err
}
var bootState string
if c.Bool("active") {
bootState = "active"
}
if c.Bool("passive") {
bootState = "passive"
for k, v := range map[string]bool{
"active": c.Bool("active"),
"passive": c.Bool("passive"),
"recovery": c.Bool("recovery"),
"common": c.Bool("common"),
} {
if v {
bootState = k
break
}
}
ext := c.Args().First()
if err := action.EnableSystemExtension(cfg, ext, bootState, c.Bool("now")); err != nil {
cfg.Logger.Logger.Error().Err(err).Msg("failed enabling system extension")
@@ -990,11 +1001,16 @@ The validate command expects a configuration file as its only argument. Local fi
return err
}
var bootState string
if c.Bool("active") {
bootState = "active"
}
if c.Bool("passive") {
bootState = "passive"
for k, v := range map[string]bool{
"active": c.Bool("active"),
"passive": c.Bool("passive"),
"recovery": c.Bool("recovery"),
"common": c.Bool("common"),
} {
if v {
bootState = k
break
}
}
ext := c.Args().First()
if err := action.DisableSystemExtension(cfg, ext, bootState, c.Bool("now")); err != nil {