Skip to content

Commit

Permalink
feat(config): make it so you can revert override of apps
Browse files Browse the repository at this point in the history
Signed-off-by: Eric Bode <[email protected]>
  • Loading branch information
StealthyCoder committed Nov 5, 2024
1 parent 5e5dfca commit 7d7142f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
9 changes: 9 additions & 0 deletions subcommands/common_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/sirupsen/logrus"

"github.com/foundriesio/fioctl/client"
"github.com/foundriesio/fioctl/subcommands"
)

// Aktualizr puts all config files into a single lexographically sorted map.
Expand Down Expand Up @@ -235,6 +236,14 @@ func SetUpdatesConfig(opts *SetUpdatesConfigOptions, reportedTag string, reporte
fmt.Printf("Setting apps to [%s]\n", opts.UpdateApps)
sota.Set("pacman.docker_apps", opts.UpdateApps)
sota.Set("pacman.compose_apps", opts.UpdateApps)
if strings.TrimSpace(opts.UpdateApps) == "-" {
if sota.Has("pacman.docker_apps") {
subcommands.DieNotNil(sota.Delete("pacman.docker_apps"))
}
if sota.Has("pacman.compose_apps") {
subcommands.DieNotNil(sota.Delete("pacman.compose_apps"))
}
}
changed = true
}
if opts.UpdateTag != "" && configuredTag != opts.UpdateTag {
Expand Down
10 changes: 9 additions & 1 deletion subcommands/config/updates.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,15 @@ in a device group. When run without options, prints out the current configuratio
fioctl config updates --group beta --apps shellhttpd
# Set the docker apps and the tag for devices:
fioctl config updates --group beta --apps shellhttpd --tag master`,
fioctl config updates --group beta --apps shellhttpd --tag master
# Set the docker apps to none for devices, this will make the device run no apps:
fioctl config updates --apps ,
# Set the docker apps to inherit from their parent, meaning:
# If for a device apps are not set - all apps are installed
  # If for a device apps are set - those apps are installed
fioctl config updates --apps -`,
}
cmd.AddCommand(configUpdatesCmd)
configUpdatesCmd.Flags().StringP("group", "g", "", "Device group to use")
Expand Down
11 changes: 10 additions & 1 deletion subcommands/devices/config_updates.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,16 @@ currently configured and reporting.`,
# Set the docker apps and the tag:
fioctl devices config updates <device> --apps shellhttpd --tag master
`,
# Set the docker apps to none, meaning it will run no apps:
fioctl devices config updates <device> --apps ,
# Set the docker apps to inherit from their parent, meaning:
# If for a device apps are not set - all apps are installed
#  If for a device apps are set* - only those apps are installed
#
# * It can be set at the individual device level, or at a device group level
fioctl devices config updates <device> --apps -`,
}
configCmd.AddCommand(configUpdatesCmd)
configUpdatesCmd.Flags().StringP("tag", "", "", "Target tag for device to follow")
Expand Down

0 comments on commit 7d7142f

Please sign in to comment.