Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Now init message has double slash #78

Merged
merged 2 commits into from
Nov 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Fixed

- Fixed incorrect s3 url when "proxy" runs on uninitialized repository.
[Refs: [#77](https://github.com/hypnoglow/helm-s3/issues/77) [#78](https://github.com/hypnoglow/helm-s3/pull/78)] [@horacimacias](https://github.com/horacimacias)

## [0.8.0]

### Added
Expand Down
12 changes: 9 additions & 3 deletions cmd/helms3/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package main
import (
"context"
"fmt"
"path"
"strings"

"github.com/pkg/errors"
Expand All @@ -16,6 +15,8 @@ type proxyCmd struct {
uri string
}

const indexYaml = "index.yaml"

func (act proxyCmd) Run(ctx context.Context) error {
sess, err := awsutil.Session(awsutil.AssumeRoleTokenProvider(awsutil.StderrTokenProvider))
if err != nil {
Expand All @@ -25,8 +26,13 @@ func (act proxyCmd) Run(ctx context.Context) error {

b, err := storage.FetchRaw(ctx, act.uri)
if err != nil {
if strings.HasSuffix(act.uri, "index.yaml") && err == awss3.ErrObjectNotFound {
return fmt.Errorf("The index file does not exist by the path %s. If you haven't initialized the repository yet, try running \"helm s3 init %s\"", act.uri, path.Dir(act.uri))
if strings.HasSuffix(act.uri, indexYaml) && err == awss3.ErrObjectNotFound {
return fmt.Errorf(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ST1005: error strings should not be capitalized (from stylecheck)

"The index file does not exist by the path %s. "+
"If you haven't initialized the repository yet, try running \"helm s3 init %s\"",
act.uri,
strings.TrimSuffix(strings.TrimSuffix(act.uri, indexYaml), "/"),
)
}
return errors.WithMessage(err, "fetch from s3")
}
Expand Down