@@ -615,7 +615,7 @@ func (c *Coordinator) Migrate(
615615 backoffFactory func (done <- chan struct {}) backoff.Backoff ,
616616 notifyFn func (context.Context , * fleetapi.ActionMigrate ) error ,
617617) error {
618- if c .specs . Platform (). OS == component . Container {
618+ if c .isContainerizedEnvironment () {
619619 return ErrContainerNotSupported
620620 }
621621 if ! c .isManaged {
@@ -1613,7 +1613,7 @@ func (c *Coordinator) processConfigAgent(ctx context.Context, cfg *config.Config
16131613 // override retrieved config from Fleet with persisted config from AgentConfig file
16141614
16151615 if c .caps != nil {
1616- if err := applyPersistedConfig (cfg , paths .ConfigFile (), c .caps .AllowFleetOverride ); err != nil {
1616+ if err := applyPersistedConfig (cfg , paths .ConfigFile (), c .isContainerizedEnvironment , c . caps .AllowFleetOverride ); err != nil {
16171617 return fmt .Errorf ("could not apply persisted configuration: %w" , err )
16181618 }
16191619 }
@@ -1705,10 +1705,12 @@ func (c *Coordinator) generateAST(cfg *config.Config, m map[string]interface{})
17051705 return nil
17061706}
17071707
1708- func applyPersistedConfig (cfg * config.Config , configFile string , checkFn func () bool ) error {
1709- if ! checkFn () {
1710- // Feature is disabled, nothing to do
1711- return nil
1708+ func applyPersistedConfig (cfg * config.Config , configFile string , checkFns ... func () bool ) error {
1709+ for _ , checkFn := range checkFns {
1710+ if ! checkFn () {
1711+ // Feature is disabled, nothing to do
1712+ return nil
1713+ }
17121714 }
17131715
17141716 f , err := os .OpenFile (configFile , os .O_RDONLY , 0 )
@@ -2397,3 +2399,7 @@ func computeEnrollOptions(ctx context.Context, cfgPath string, cfgFleetPath stri
23972399 options = enroll .FromFleetConfig (cfg .Fleet )
23982400 return options , nil
23992401}
2402+
2403+ func (c * Coordinator ) isContainerizedEnvironment () bool {
2404+ return c .specs .Platform ().OS == component .Container
2405+ }
0 commit comments