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
bce805f6
Commit
bce805f6
authored
Oct 10, 2016
by
Matt Butcher
Committed by
GitHub
Oct 10, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1319 from technosophos/ref/1318-remove-old-funcs
ref(helm): remove old structure functions
parents
6173e5b4
b9fb8abd
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
27 additions
and
93 deletions
+27
-93
dependency_build_test.go
cmd/helm/dependency_build_test.go
+1
-1
dependency_update_test.go
cmd/helm/dependency_update_test.go
+1
-1
helm.go
cmd/helm/helm.go
+5
-9
helm_test.go
cmd/helm/helm_test.go
+10
-1
init.go
cmd/helm/init.go
+2
-14
init_test.go
cmd/helm/init_test.go
+1
-1
install.go
cmd/helm/install.go
+1
-1
repo_update.go
cmd/helm/repo_update.go
+1
-3
repo_update_test.go
cmd/helm/repo_update_test.go
+5
-4
search.go
cmd/helm/search.go
+0
-1
structure.go
cmd/helm/structure.go
+0
-57
No files found.
cmd/helm/dependency_build_test.go
View file @
bce805f6
...
@@ -103,7 +103,7 @@ func TestDependencyBuildCmd(t *testing.T) {
...
@@ -103,7 +103,7 @@ func TestDependencyBuildCmd(t *testing.T) {
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
i
,
err
:=
repo
.
LoadIndexFile
(
cacheIndexFile
(
"test"
))
i
,
err
:=
repo
.
LoadIndexFile
(
dbc
.
helmhome
.
CacheIndex
(
"test"
))
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
...
...
cmd/helm/dependency_update_test.go
View file @
bce805f6
...
@@ -85,7 +85,7 @@ func TestDependencyUpdateCmd(t *testing.T) {
...
@@ -85,7 +85,7 @@ func TestDependencyUpdateCmd(t *testing.T) {
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
i
,
err
:=
repo
.
LoadIndexFile
(
cacheIndexFile
(
"test"
))
i
,
err
:=
repo
.
LoadIndexFile
(
duc
.
helmhome
.
CacheIndex
(
"test"
))
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
...
...
cmd/helm/helm.go
View file @
bce805f6
...
@@ -28,6 +28,7 @@ import (
...
@@ -28,6 +28,7 @@ import (
)
)
const
(
const
(
localRepoIndexFilePath
=
"index.yaml"
homeEnvVar
=
"HELM_HOME"
homeEnvVar
=
"HELM_HOME"
hostEnvVar
=
"HELM_HOST"
hostEnvVar
=
"HELM_HOST"
tillerNamespace
=
"kube-system"
tillerNamespace
=
"kube-system"
...
@@ -159,15 +160,6 @@ func checkArgsLength(argsReceived int, requiredArgs ...string) error {
...
@@ -159,15 +160,6 @@ func checkArgsLength(argsReceived int, requiredArgs ...string) error {
return
nil
return
nil
}
}
// requireInit is a PreRunE implementation for validating that $HELM_HOME is configured.
func
requireInit
(
cmd
*
cobra
.
Command
,
args
[]
string
)
error
{
err
:=
requireHome
()
if
err
!=
nil
{
return
fmt
.
Errorf
(
"%s (try running 'helm init')"
,
err
)
}
return
nil
}
// prettyError unwraps or rewrites certain errors to make them more user-friendly.
// prettyError unwraps or rewrites certain errors to make them more user-friendly.
func
prettyError
(
err
error
)
error
{
func
prettyError
(
err
error
)
error
{
if
err
==
nil
{
if
err
==
nil
{
...
@@ -178,3 +170,7 @@ func prettyError(err error) error {
...
@@ -178,3 +170,7 @@ func prettyError(err error) error {
// the desc. Instead, we have to pass ALL errors through this.
// the desc. Instead, we have to pass ALL errors through this.
return
errors
.
New
(
grpc
.
ErrorDesc
(
err
))
return
errors
.
New
(
grpc
.
ErrorDesc
(
err
))
}
}
func
homePath
()
string
{
return
os
.
ExpandEnv
(
helmHome
)
}
cmd/helm/helm_test.go
View file @
bce805f6
...
@@ -255,6 +255,15 @@ func ensureTestHome(home helmpath.Home, t *testing.T) error {
...
@@ -255,6 +255,15 @@ func ensureTestHome(home helmpath.Home, t *testing.T) error {
repoFile
:=
home
.
RepositoryFile
()
repoFile
:=
home
.
RepositoryFile
()
if
fi
,
err
:=
os
.
Stat
(
repoFile
);
err
!=
nil
{
if
fi
,
err
:=
os
.
Stat
(
repoFile
);
err
!=
nil
{
rf
:=
repo
.
NewRepoFile
()
rf
:=
repo
.
NewRepoFile
()
rf
.
Add
(
&
repo
.
Entry
{
Name
:
"charts"
,
URL
:
"http://example.com/foo"
,
Cache
:
"charts-index.yaml"
,
},
&
repo
.
Entry
{
Name
:
"local"
,
URL
:
"http://localhost.com:7743/foo"
,
Cache
:
"local-index.yaml"
,
})
if
err
:=
rf
.
WriteFile
(
repoFile
,
0644
);
err
!=
nil
{
if
err
:=
rf
.
WriteFile
(
repoFile
,
0644
);
err
!=
nil
{
return
err
return
err
}
}
...
@@ -276,7 +285,7 @@ func ensureTestHome(home helmpath.Home, t *testing.T) error {
...
@@ -276,7 +285,7 @@ func ensureTestHome(home helmpath.Home, t *testing.T) error {
}
}
//TODO: take this out and replace with helm update functionality
//TODO: take this out and replace with helm update functionality
os
.
Symlink
(
localRepoIndexFile
,
cacheDirectory
(
"local-index.yam
l"
))
os
.
Symlink
(
localRepoIndexFile
,
home
.
CacheIndex
(
"loca
l"
))
}
else
if
fi
.
IsDir
()
{
}
else
if
fi
.
IsDir
()
{
return
fmt
.
Errorf
(
"%s must be a file, not a directory"
,
localRepoIndexFile
)
return
fmt
.
Errorf
(
"%s must be a file, not a directory"
,
localRepoIndexFile
)
}
}
...
...
cmd/helm/init.go
View file @
bce805f6
...
@@ -92,18 +92,6 @@ func (i *initCmd) run() error {
...
@@ -92,18 +92,6 @@ func (i *initCmd) run() error {
return
nil
return
nil
}
}
func
requireHome
()
error
{
dirs
:=
[]
string
{
homePath
(),
repositoryDirectory
(),
cacheDirectory
(),
localRepoDirectory
()}
for
_
,
d
:=
range
dirs
{
if
fi
,
err
:=
os
.
Stat
(
d
);
err
!=
nil
{
return
fmt
.
Errorf
(
"directory %q is not configured"
,
d
)
}
else
if
!
fi
.
IsDir
()
{
return
fmt
.
Errorf
(
"expected %q to be a directory"
,
d
)
}
}
return
nil
}
// ensureHome checks to see if $HELM_HOME exists
// ensureHome checks to see if $HELM_HOME exists
//
//
// If $HELM_HOME does not exist, this function will create it.
// If $HELM_HOME does not exist, this function will create it.
...
@@ -150,7 +138,7 @@ func ensureHome(home helmpath.Home, out io.Writer) error {
...
@@ -150,7 +138,7 @@ func ensureHome(home helmpath.Home, out io.Writer) error {
}
}
}
}
localRepoIndexFile
:=
localRepoDirec
tory
(
localRepoIndexFilePath
)
localRepoIndexFile
:=
home
.
LocalReposi
tory
(
localRepoIndexFilePath
)
if
fi
,
err
:=
os
.
Stat
(
localRepoIndexFile
);
err
!=
nil
{
if
fi
,
err
:=
os
.
Stat
(
localRepoIndexFile
);
err
!=
nil
{
fmt
.
Fprintf
(
out
,
"Creating %s
\n
"
,
localRepoIndexFile
)
fmt
.
Fprintf
(
out
,
"Creating %s
\n
"
,
localRepoIndexFile
)
i
:=
repo
.
NewIndexFile
()
i
:=
repo
.
NewIndexFile
()
...
@@ -159,7 +147,7 @@ func ensureHome(home helmpath.Home, out io.Writer) error {
...
@@ -159,7 +147,7 @@ func ensureHome(home helmpath.Home, out io.Writer) error {
}
}
//TODO: take this out and replace with helm update functionality
//TODO: take this out and replace with helm update functionality
os
.
Symlink
(
localRepoIndexFile
,
cacheDirectory
(
"local-index.yam
l"
))
os
.
Symlink
(
localRepoIndexFile
,
home
.
CacheIndex
(
"loca
l"
))
}
else
if
fi
.
IsDir
()
{
}
else
if
fi
.
IsDir
()
{
return
fmt
.
Errorf
(
"%s must be a file, not a directory"
,
localRepoIndexFile
)
return
fmt
.
Errorf
(
"%s must be a file, not a directory"
,
localRepoIndexFile
)
}
}
...
...
cmd/helm/init_test.go
View file @
bce805f6
...
@@ -54,7 +54,7 @@ func TestEnsureHome(t *testing.T) {
...
@@ -54,7 +54,7 @@ func TestEnsureHome(t *testing.T) {
t
.
Errorf
(
"%s should not be a directory"
,
fi
)
t
.
Errorf
(
"%s should not be a directory"
,
fi
)
}
}
if
fi
,
err
:=
os
.
Stat
(
localRepoDirec
tory
(
localRepoIndexFilePath
));
err
!=
nil
{
if
fi
,
err
:=
os
.
Stat
(
hh
.
LocalReposi
tory
(
localRepoIndexFilePath
));
err
!=
nil
{
t
.
Errorf
(
"%s"
,
err
)
t
.
Errorf
(
"%s"
,
err
)
}
else
if
fi
.
IsDir
()
{
}
else
if
fi
.
IsDir
()
{
t
.
Errorf
(
"%s should not be a directory"
,
fi
)
t
.
Errorf
(
"%s should not be a directory"
,
fi
)
...
...
cmd/helm/install.go
View file @
bce805f6
...
@@ -323,7 +323,7 @@ func locateChartPath(name, version string, verify bool, keyring string) (string,
...
@@ -323,7 +323,7 @@ func locateChartPath(name, version string, verify bool, keyring string) (string,
return
name
,
fmt
.
Errorf
(
"path %q not found"
,
name
)
return
name
,
fmt
.
Errorf
(
"path %q not found"
,
name
)
}
}
crepo
:=
filepath
.
Join
(
repositoryDirec
tory
(),
name
)
crepo
:=
filepath
.
Join
(
helmpath
.
Home
(
homePath
())
.
Reposi
tory
(),
name
)
if
_
,
err
:=
os
.
Stat
(
crepo
);
err
==
nil
{
if
_
,
err
:=
os
.
Stat
(
crepo
);
err
==
nil
{
return
filepath
.
Abs
(
crepo
)
return
filepath
.
Abs
(
crepo
)
}
}
...
...
cmd/helm/repo_update.go
View file @
bce805f6
...
@@ -37,7 +37,6 @@ future releases.
...
@@ -37,7 +37,6 @@ future releases.
`
`
type
repoUpdateCmd
struct
{
type
repoUpdateCmd
struct
{
repoFile
string
update
func
([]
*
repo
.
Entry
,
bool
,
io
.
Writer
,
helmpath
.
Home
)
update
func
([]
*
repo
.
Entry
,
bool
,
io
.
Writer
,
helmpath
.
Home
)
out
io
.
Writer
out
io
.
Writer
home
helmpath
.
Home
home
helmpath
.
Home
...
@@ -47,7 +46,6 @@ func newRepoUpdateCmd(out io.Writer) *cobra.Command {
...
@@ -47,7 +46,6 @@ func newRepoUpdateCmd(out io.Writer) *cobra.Command {
u
:=
&
repoUpdateCmd
{
u
:=
&
repoUpdateCmd
{
out
:
out
,
out
:
out
,
update
:
updateCharts
,
update
:
updateCharts
,
repoFile
:
repositoriesFile
(),
}
}
cmd
:=
&
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"update"
,
Use
:
"update"
,
...
@@ -63,7 +61,7 @@ func newRepoUpdateCmd(out io.Writer) *cobra.Command {
...
@@ -63,7 +61,7 @@ func newRepoUpdateCmd(out io.Writer) *cobra.Command {
}
}
func
(
u
*
repoUpdateCmd
)
run
()
error
{
func
(
u
*
repoUpdateCmd
)
run
()
error
{
f
,
err
:=
repo
.
LoadRepositoriesFile
(
u
.
repoFile
)
f
,
err
:=
repo
.
LoadRepositoriesFile
(
u
.
home
.
RepositoryFile
()
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
...
...
cmd/helm/repo_update_test.go
View file @
bce805f6
...
@@ -29,7 +29,6 @@ import (
...
@@ -29,7 +29,6 @@ import (
)
)
func
TestUpdateCmd
(
t
*
testing
.
T
)
{
func
TestUpdateCmd
(
t
*
testing
.
T
)
{
thome
,
err
:=
tempHelmHome
(
t
)
thome
,
err
:=
tempHelmHome
(
t
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
...
@@ -52,12 +51,14 @@ func TestUpdateCmd(t *testing.T) {
...
@@ -52,12 +51,14 @@ func TestUpdateCmd(t *testing.T) {
uc
:=
&
repoUpdateCmd
{
uc
:=
&
repoUpdateCmd
{
out
:
out
,
out
:
out
,
update
:
updater
,
update
:
updater
,
repoFile
:
"testdata/repositories.yaml"
,
home
:
helmpath
.
Home
(
thome
),
}
if
err
:=
uc
.
run
();
err
!=
nil
{
t
.
Fatal
(
err
)
}
}
uc
.
run
()
if
got
:=
out
.
String
();
!
strings
.
Contains
(
got
,
"charts"
)
||
!
strings
.
Contains
(
got
,
"local"
)
{
if
got
:=
out
.
String
();
!
strings
.
Contains
(
got
,
"charts"
)
||
!
strings
.
Contains
(
got
,
"local"
)
{
t
.
Errorf
(
"Expected 'charts' and 'local' (in any order) got %
s
"
,
got
)
t
.
Errorf
(
"Expected 'charts' and 'local' (in any order) got %
q
"
,
got
)
}
}
}
}
...
...
cmd/helm/search.go
View file @
bce805f6
...
@@ -57,7 +57,6 @@ func newSearchCmd(out io.Writer) *cobra.Command {
...
@@ -57,7 +57,6 @@ func newSearchCmd(out io.Writer) *cobra.Command {
RunE
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
error
{
RunE
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
error
{
return
sc
.
run
(
args
)
return
sc
.
run
(
args
)
},
},
PreRunE
:
requireInit
,
}
}
f
:=
cmd
.
Flags
()
f
:=
cmd
.
Flags
()
...
...
cmd/helm/structure.go
deleted
100644 → 0
View file @
6173e5b4
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package
main
import
(
"os"
"path/filepath"
)
const
(
repositoryDir
string
=
"repository"
repositoriesFilePath
string
=
"repositories.yaml"
cachePath
string
=
"cache"
localRepoPath
string
=
"local"
localRepoIndexFilePath
string
=
"index.yaml"
)
func
homePath
()
string
{
return
os
.
ExpandEnv
(
helmHome
)
}
// All other directories go under the $HELM_HOME/repository.
func
repositoryDirectory
()
string
{
return
homePath
()
+
"/"
+
repositoryDir
}
func
cacheDirectory
(
paths
...
string
)
string
{
fragments
:=
append
([]
string
{
repositoryDirectory
(),
cachePath
},
paths
...
)
return
filepath
.
Join
(
fragments
...
)
}
func
cacheIndexFile
(
repoName
string
)
string
{
return
cacheDirectory
(
repoName
+
"-index.yaml"
)
}
func
localRepoDirectory
(
paths
...
string
)
string
{
fragments
:=
append
([]
string
{
repositoryDirectory
(),
localRepoPath
},
paths
...
)
return
filepath
.
Join
(
fragments
...
)
}
func
repositoriesFile
()
string
{
return
filepath
.
Join
(
repositoryDirectory
(),
repositoriesFilePath
)
}
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