Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
helm3
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
helm3
Commits
e3967e57
Commit
e3967e57
authored
May 19, 2016
by
Matt Butcher
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #742 from technosophos/fix/703-support-repo-names
fix(helm): allow repo names in helm install
parents
968901f9
97cff394
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
2 deletions
+34
-2
install.go
cmd/helm/install.go
+34
-2
No files found.
cmd/helm/install.go
View file @
e3967e57
...
...
@@ -3,6 +3,9 @@ package main
import
(
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
"github.com/spf13/cobra"
...
...
@@ -51,14 +54,20 @@ func runInstall(cmd *cobra.Command, args []string) error {
if
err
:=
checkArgsLength
(
1
,
len
(
args
),
"chart name"
);
err
!=
nil
{
return
err
}
installArg
=
args
[
0
]
chartpath
,
err
:=
locateChartPath
(
args
[
0
])
if
err
!=
nil
{
return
err
}
if
flagVerbose
{
fmt
.
Printf
(
"Chart path: %s
\n
"
,
chartpath
)
}
rawVals
,
err
:=
vals
()
if
err
!=
nil
{
return
err
}
res
,
err
:=
helm
.
InstallRelease
(
rawVals
,
installRelName
,
installArg
,
installDryRun
)
res
,
err
:=
helm
.
InstallRelease
(
rawVals
,
installRelName
,
chartpath
,
installDryRun
)
if
err
!=
nil
{
return
prettyError
(
err
)
}
...
...
@@ -88,3 +97,26 @@ func printRelease(rel *release.Release) {
fmt
.
Println
(
rel
.
Name
)
}
}
// locateChartPath looks for a chart directory in known places, and returns either the full path or an error.
//
// This does not ensure that the chart is well-formed; only that the requested filename exists.
//
// Order of resolution:
// - current working directory
// - if path is absolute or begins with '.', error out here
// - chart repos in $HELM_HOME
func
locateChartPath
(
name
string
)
(
string
,
error
)
{
if
_
,
err
:=
os
.
Stat
(
name
);
err
==
nil
{
return
filepath
.
Abs
(
name
)
}
if
filepath
.
IsAbs
(
name
)
||
strings
.
HasPrefix
(
name
,
"."
)
{
return
name
,
fmt
.
Errorf
(
"path %q not found"
,
name
)
}
crepo
:=
filepath
.
Join
(
repositoryDirectory
(),
name
)
if
_
,
err
:=
os
.
Stat
(
crepo
);
err
==
nil
{
return
filepath
.
Abs
(
crepo
)
}
return
name
,
fmt
.
Errorf
(
"file %q not found"
,
name
)
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment