Skip to content

Commit

Permalink
Incorporate review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
carolynvs-msft committed Apr 12, 2019
1 parent 28576d4 commit f3ba003
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
5 changes: 4 additions & 1 deletion cmd/porter/mixins.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,11 @@ func buildMixinsListCommand(p *porter.Porter) *cobra.Command {
func BuildMixinInstallCommand(p *porter.Porter) *cobra.Command {
opts := mixin.InstallOptions{}
cmd := &cobra.Command{
Use: "install",
Use: "install NAME",
Short: "Install a mixin",
Example: ` porter mixin install helm --url https://deislabs.blob.core.windows.net/porter/mixins/helm
porter mixin install azure --version v0.4.0-ralpha.1+dubonnet --url https://deislabs.blob.core.windows.net/porter/mixins/azure
porter mixin install kubernetes --version canary --url https://deislabs.blob.core.windows.net/porter/mixins/kubernetes`,
PreRunE: func(cmd *cobra.Command, args []string) error {
return opts.Validate(args)
},
Expand Down
4 changes: 2 additions & 2 deletions pkg/mixin/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type InstallOptions struct {
parsedURL *url.URL
}

// CopyParsedURL returns a copy of of the parsed URL that is safe to modify.
// GetParsedURL returns a copy of of the parsed URL that is safe to modify.
func (o *InstallOptions) GetParsedURL() url.URL {
return *o.parsedURL
}
Expand Down Expand Up @@ -51,7 +51,7 @@ func (o *InstallOptions) defaultVersion() {
}
}

// validateClaimName grabs the claim name from the first positional argument.
// validateMixinName grabs the mixin name from the first positional argument.
func (o *InstallOptions) validateMixinName(args []string) error {
switch len(args) {
case 0:
Expand Down
7 changes: 4 additions & 3 deletions pkg/mixin/provider/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ func (p *FileSystem) Install(opts mixin.InstallOptions) (mixin.Metadata, error)
}

func (p *FileSystem) downloadFile(url url.URL, destPath string) error {
if p.Debug {
fmt.Fprintf(p.Err, "Downloading %s to %s\n", url.String(), destPath)
}

// Ensure the parent directories exist
parentDir := filepath.Dir(destPath)
err := p.FileSystem.MkdirAll(parentDir, 0755)
Expand All @@ -71,9 +75,6 @@ func (p *FileSystem) downloadFile(url url.URL, destPath string) error {
return errors.Wrapf(err, "could not set the mixin as executable at %s", destPath)
}

if p.Debug {
fmt.Fprintf(p.Err, "Downloading %s to %s\n", url.String(), destPath)
}
_, err = io.Copy(destFile, resp.Body)
if err != nil {
return errors.Wrapf(err, "error writing the mixin to %s", destPath)
Expand Down

0 comments on commit f3ba003

Please sign in to comment.