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
a3d56852
Commit
a3d56852
authored
Aug 26, 2016
by
joe2far
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(helm): make repo remove clear cache
parent
56500729
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
3 deletions
+27
-3
repo.go
cmd/helm/repo.go
+15
-1
repo_test.go
cmd/helm/repo_test.go
+7
-0
structure.go
cmd/helm/structure.go
+4
-0
update.go
cmd/helm/update.go
+1
-2
No files found.
cmd/helm/repo.go
View file @
a3d56852
...
...
@@ -20,6 +20,7 @@ import (
"errors"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"github.com/gosuri/uitable"
...
...
@@ -129,7 +130,7 @@ func index(dir, url string) error {
}
func
addRepository
(
name
,
url
string
)
error
{
if
err
:=
repo
.
DownloadIndexFile
(
name
,
url
,
cache
Directory
(
name
+
"-index.yaml"
));
err
!=
nil
{
if
err
:=
repo
.
DownloadIndexFile
(
name
,
url
,
cache
IndexFile
(
name
));
err
!=
nil
{
return
errors
.
New
(
"Looks like "
+
url
+
" is not a valid chart repository or cannot be reached: "
+
err
.
Error
())
}
...
...
@@ -152,6 +153,9 @@ func removeRepoLine(name string) error {
if
err
:=
ioutil
.
WriteFile
(
repositoriesFile
(),
b
,
0666
);
err
!=
nil
{
return
err
}
if
err
:=
removeRepoCache
(
name
);
err
!=
nil
{
return
err
}
}
else
{
return
fmt
.
Errorf
(
"The repository, %s, does not exist in your repositories list"
,
name
)
...
...
@@ -160,6 +164,16 @@ func removeRepoLine(name string) error {
return
nil
}
func
removeRepoCache
(
name
string
)
error
{
if
_
,
err
:=
os
.
Stat
(
cacheIndexFile
(
name
));
err
==
nil
{
err
=
os
.
Remove
(
cacheIndexFile
(
name
))
if
err
!=
nil
{
return
err
}
}
return
nil
}
func
insertRepoLine
(
name
,
url
string
)
error
{
f
,
err
:=
repo
.
LoadRepositoriesFile
(
repositoriesFile
())
if
err
!=
nil
{
...
...
cmd/helm/repo_test.go
View file @
a3d56852
...
...
@@ -82,10 +82,17 @@ func TestRepoRemove(t *testing.T) {
t
.
Errorf
(
"%s"
,
err
)
}
mf
,
_
:=
os
.
Create
(
cacheIndexFile
(
testName
))
mf
.
Close
()
if
err
:=
removeRepoLine
(
testName
);
err
!=
nil
{
t
.
Errorf
(
"Error removing %s from repositories"
,
testName
)
}
if
_
,
err
:=
os
.
Stat
(
cacheIndexFile
(
testName
));
err
==
nil
{
t
.
Errorf
(
"Error cache file was not removed for repository %s"
,
testName
)
}
f
,
err
:=
repo
.
LoadRepositoriesFile
(
repositoriesFile
())
if
err
!=
nil
{
t
.
Errorf
(
"%s"
,
err
)
...
...
cmd/helm/structure.go
View file @
a3d56852
...
...
@@ -43,6 +43,10 @@ func cacheDirectory(paths ...string) string {
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
...
)
...
...
cmd/helm/update.go
View file @
a3d56852
...
...
@@ -62,8 +62,7 @@ func updateCharts(repos map[string]string, verbose bool) {
wg
.
Add
(
1
)
go
func
(
n
,
u
string
)
{
defer
wg
.
Done
()
indexFileName
:=
cacheDirectory
(
n
+
"-index.yaml"
)
err
:=
repo
.
DownloadIndexFile
(
n
,
u
,
indexFileName
)
err
:=
repo
.
DownloadIndexFile
(
n
,
u
,
cacheIndexFile
(
n
))
if
err
!=
nil
{
updateErr
:=
"...Unable to get an update from the "
+
n
+
" chart repository"
if
verbose
{
...
...
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