feat: coordinate Active Profile target panel
This commit is contained in:
+24
-1
@@ -15,7 +15,10 @@ import (
|
||||
"golang.org/x/sys/unix"
|
||||
|
||||
"proxyctl/internal/app"
|
||||
"proxyctl/internal/apt"
|
||||
"proxyctl/internal/dockerclient"
|
||||
"proxyctl/internal/dockerdaemon"
|
||||
"proxyctl/internal/gnome"
|
||||
"proxyctl/internal/operationlock"
|
||||
"proxyctl/internal/oplog"
|
||||
"proxyctl/internal/profile"
|
||||
@@ -76,7 +79,10 @@ func runWithEnvironmentAndTargets(args []string, input io.Reader, output io.Writ
|
||||
}
|
||||
shellTarget := shell.New(shellConfiguration, files, environment)
|
||||
if systemTargets == nil {
|
||||
systemTargets = []target.Target{dockerdaemon.New(dockerdaemon.DefaultConfiguration(), nil, nil)}
|
||||
systemTargets, err = productionTargets(environment)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
targets := append([]target.Target{shellTarget}, systemTargets...)
|
||||
stateDirectory := filepath.Dir(shellConfiguration.RecoveryFile)
|
||||
@@ -136,6 +142,23 @@ func runWithEnvironmentAndTargets(args []string, input io.Reader, output io.Writ
|
||||
return err
|
||||
}
|
||||
|
||||
func productionTargets(environment profile.IdentityEnvironment) ([]target.Target, error) {
|
||||
dockerClientConfiguration, err := dockerclient.ResolveConfiguration(environment)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("resolve Docker containers/builds Target configuration: %w", err)
|
||||
}
|
||||
gnomeConfiguration, err := gnome.ResolveConfiguration(environment)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("resolve GNOME Target configuration: %w", err)
|
||||
}
|
||||
return []target.Target{
|
||||
apt.New(apt.DefaultConfiguration(), nil, nil),
|
||||
dockerclient.New(dockerClientConfiguration, nil),
|
||||
gnome.New(gnomeConfiguration, nil, nil),
|
||||
dockerdaemon.New(dockerdaemon.DefaultConfiguration(), nil, nil),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func runMaintenanceCommand(args []string, input io.Reader, output io.Writer, store *profile.FileStore, targets []target.Target, mutationLock app.MutationLock, logger app.OperationLogger, checks []target.Check) error {
|
||||
if len(args) != 1 {
|
||||
return errors.New("invalid maintenance command")
|
||||
|
||||
Reference in New Issue
Block a user