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
876cbc20
Unverified
Commit
876cbc20
authored
Jul 11, 2017
by
Adam Reese
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(helm): support HELM_HOME during plugin loading
closes #2630
parent
76d3161e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
0 deletions
+23
-0
load_plugins.go
cmd/helm/load_plugins.go
+11
-0
plugin_test.go
cmd/helm/plugin_test.go
+12
-0
No files found.
cmd/helm/load_plugins.go
View file @
876cbc20
...
...
@@ -24,6 +24,7 @@ import (
"strings"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
helm_env
"k8s.io/helm/pkg/helm/environment"
"k8s.io/helm/pkg/plugin"
...
...
@@ -41,6 +42,16 @@ func loadPlugins(baseCmd *cobra.Command, out io.Writer) {
return
}
// manually handel processing of HELM_HOME and --home
helmHome
:=
"$HOME/.helm"
if
h
,
ok
:=
os
.
LookupEnv
(
"HELM_HOME"
);
ok
{
helmHome
=
h
}
fs
:=
pflag
.
NewFlagSet
(
"homer"
,
pflag
.
ContinueOnError
)
fs
.
StringVar
((
*
string
)(
&
settings
.
Home
),
"home"
,
helmHome
,
"location of your Helm config. Overrides $HELM_HOME"
)
fs
.
Parse
(
os
.
Args
)
found
,
err
:=
findPlugins
(
settings
.
PluginDirs
())
if
err
!=
nil
{
fmt
.
Fprintf
(
os
.
Stderr
,
"failed to load plugins: %s"
,
err
)
...
...
cmd/helm/plugin_test.go
View file @
876cbc20
...
...
@@ -64,12 +64,24 @@ func TestManuallyProcessArgs(t *testing.T) {
}
// resetEnv sets an env var, and returns a defer function to reset the env
func
resetEnv
(
name
,
val
string
)
func
()
{
original
,
ok
:=
os
.
LookupEnv
(
name
)
os
.
Setenv
(
name
,
val
)
if
ok
{
return
func
()
{
os
.
Setenv
(
name
,
original
)
}
}
return
func
()
{
os
.
Unsetenv
(
name
)
}
}
func
TestLoadPlugins
(
t
*
testing
.
T
)
{
// Set helm home to point to testdata
old
:=
settings
.
Home
settings
.
Home
=
"testdata/helmhome"
cleanup
:=
resetEnv
(
"HELM_HOME"
,
settings
.
Home
.
String
())
defer
func
()
{
settings
.
Home
=
old
cleanup
()
}()
hh
:=
settings
.
Home
...
...
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