Browse Source

Disabled Mutagen service scaling via up's --scale flag.

There was an edge case where scaling could have been specified for the
Mutagen service. This commit disables that case.

Signed-off-by: Jacob Howard <jacob@havoc.io>
tags/v0.12.0-alpha3
Jacob Howard 2 months ago
parent
commit
681dd8e28a
1 changed files with 12 additions and 0 deletions
  1. 12
    0
      cmd/mutagen/compose/up.go

+ 12
- 0
cmd/mutagen/compose/up.go View File

@@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"os"
"strings"

"github.com/spf13/cobra"

@@ -21,6 +22,12 @@ import (
"github.com/mutagen-io/mutagen/pkg/synchronization"
)

const (
// mutagenScalePrefix is the prefix that would be used to scale the Mutagen
// service in a --scale flag.
mutagenScalePrefix = compose.MutagenServiceName + "="
)

// ensureMutagenUp ensures that the Mutagen service is running and up-to-date.
func ensureMutagenUp(topLevelFlags []string) error {
// Set up command flags and arguments. We honor certain up command flags
@@ -245,6 +252,11 @@ func upMain(command *cobra.Command, arguments []string) error {
return errors.New("the Mutagen service should not be controlled directly")
}
}
for _, scaling := range upConfiguration.scale {
if strings.HasPrefix(scaling, mutagenScalePrefix) {
return errors.New("the Mutagen service cannot be scaled")
}
}

// Load project metadata and defer the release of project resources.
project, err := compose.LoadProject(

Loading…
Cancel
Save