MCPcopy
hub / github.com/docker/compose / isSwarmEnabled

Method isSwarmEnabled

pkg/compose/compose.go:480–494  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

478}{}
479
480func (s *composeService) isSwarmEnabled(ctx context.Context) (bool, error) {
481 swarmEnabled.once.Do(func() {
482 res, err := s.apiClient().Info(ctx, client.InfoOptions{})
483 if err != nil {
484 swarmEnabled.err = err
485 }
486 switch res.Info.Swarm.LocalNodeState {
487 case swarm.LocalNodeStateInactive, swarm.LocalNodeStateLocked:
488 swarmEnabled.val = false
489 default:
490 swarmEnabled.val = true
491 }
492 })
493 return swarmEnabled.val, swarmEnabled.err
494}
495
496// runtimeVersionCache caches a version string after a successful lookup.
497// Errors (including context cancellation) are not cached so that

Callers 1

Calls 2

apiClientMethod · 0.95
InfoMethod · 0.45

Tested by

no test coverage detected