Skip to content

Commit

Permalink
Rename push flag from --replace to --force
Browse files Browse the repository at this point in the history
  • Loading branch information
hypnoglow committed Feb 28, 2018
1 parent 7d44f0a commit 12ce973
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions cmd/helms3/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func main() {
pushTargetRepository := pushCmd.Arg("repo", "Target repository to push to").
Required().
String()
pushReplace := pushCmd.Flag("replace", "Replace the chart if it already exists").
pushForce := pushCmd.Flag("force", "Replace the chart if it already exists. This can cause the repository to lose existing chart; use it with care").
Bool()

reindexCmd := cli.Command(actionReindex, "Reindex the repository.")
Expand Down Expand Up @@ -98,7 +98,7 @@ func main() {
act = pushAction{
chartPath: *pushChartPath,
repoName: *pushTargetRepository,
replace: *pushReplace,
force: *pushForce,
}

case actionReindex:
Expand All @@ -125,7 +125,7 @@ func main() {
switch err {
case nil:
case ErrChartExists:
log.Fatalf("The chart already exists in the repository and cannot be overwritten without an explicit intent. If you want to replace existing chart, use --replace flag:\n\n\thelm s3 push --replace %s %s\n\n", *pushChartPath, *pushTargetRepository)
log.Fatalf("The chart already exists in the repository and cannot be overwritten without an explicit intent. If you want to replace existing chart, use --force flag:\n\n\thelm s3 push --force %s %s\n\n", *pushChartPath, *pushTargetRepository)
default:
log.Fatal(err)
}
Expand Down
6 changes: 3 additions & 3 deletions cmd/helms3/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ import (

var (
// ErrChartExists signals that chart already exists in the repository
// and cannot be pushed without --replace flag.
// and cannot be pushed without --force flag.
ErrChartExists = errors.New("chart already exists")
)

type pushAction struct {
chartPath string
repoName string
replace bool
force bool
}

func (act pushAction) Run(ctx context.Context) error {
Expand Down Expand Up @@ -81,7 +81,7 @@ func (act pushAction) Run(ctx context.Context) error {
return errors.WithMessage(err, "check if chart already exists in the repository")
}

if exists && !act.replace {
if exists && !act.force {
return ErrChartExists
}

Expand Down
4 changes: 2 additions & 2 deletions hack/integration-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ fi

set -e

helm s3 push --replace postgresql-0.8.3.tgz test-repo
helm s3 push --force postgresql-0.8.3.tgz test-repo
if [ $? -ne 0 ]; then
echo "The same chart must be pushed again using --replace"
echo "The same chart must be pushed again using --force"
exit 1
fi

Expand Down

0 comments on commit 12ce973

Please sign in to comment.