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
f9c06b1d
Commit
f9c06b1d
authored
Apr 19, 2016
by
Michelle Noorali
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(init): add cache.txt to $HELM_HOME/local
parent
a5a1ef95
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
1 deletion
+19
-1
init.go
cmd/helm/init.go
+19
-1
No files found.
cmd/helm/init.go
View file @
f9c06b1d
...
@@ -20,6 +20,7 @@ Kubernetes Cluster and sets up local configuration in $HELM_HOME (default: ~/.he
...
@@ -20,6 +20,7 @@ Kubernetes Cluster and sets up local configuration in $HELM_HOME (default: ~/.he
const
repositoriesPath
=
".repositories"
const
repositoriesPath
=
".repositories"
const
cachePath
=
"cache"
const
cachePath
=
"cache"
const
localPath
=
"local"
const
localPath
=
"local"
const
localCacheFilePath
=
localPath
+
"/cache.txt"
var
defaultRepo
=
map
[
string
]
string
{
"default-name"
:
"default-url"
}
var
defaultRepo
=
map
[
string
]
string
{
"default-name"
:
"default-url"
}
var
tillerImg
string
var
tillerImg
string
...
@@ -96,12 +97,25 @@ func ensureHome(home string) error {
...
@@ -96,12 +97,25 @@ func ensureHome(home string) error {
repoPath
:=
repositoriesFile
(
home
)
repoPath
:=
repositoriesFile
(
home
)
if
fi
,
err
:=
os
.
Stat
(
repoPath
);
err
!=
nil
{
if
fi
,
err
:=
os
.
Stat
(
repoPath
);
err
!=
nil
{
fmt
.
Printf
(
"Creating %s
\n
"
,
repoPath
)
fmt
.
Printf
(
"Creating %s
\n
"
,
repoPath
)
if
err
:=
ioutil
.
WriteFile
(
repoPath
,
[]
byte
(
"
test-charts: https://www.googleapis.com/storage/v1/b/test-charts/o
\n
"
),
0644
);
err
!=
nil
{
if
err
:=
ioutil
.
WriteFile
(
repoPath
,
[]
byte
(
"
local: localhost:8879/charts
"
),
0644
);
err
!=
nil
{
return
err
return
err
}
}
}
else
if
fi
.
IsDir
()
{
}
else
if
fi
.
IsDir
()
{
return
fmt
.
Errorf
(
"%s must be a file, not a directory"
,
repoPath
)
return
fmt
.
Errorf
(
"%s must be a file, not a directory"
,
repoPath
)
}
}
localCacheFile
:=
LocalDirCacheFile
(
home
)
if
fi
,
err
:=
os
.
Stat
(
localCacheFile
);
err
!=
nil
{
fmt
.
Printf
(
"Creating %s
\n
"
,
localCacheFile
)
_
,
err
:=
os
.
Create
(
localCacheFile
)
if
err
!=
nil
{
return
err
}
os
.
Symlink
(
localCacheFile
,
CacheDirectory
(
home
)
+
"/local-cache.txt"
)
}
else
if
fi
.
IsDir
()
{
return
fmt
.
Errorf
(
"%s must be a file, not a directory."
,
repoPath
)
}
return
nil
return
nil
}
}
...
@@ -116,3 +130,7 @@ func repositoriesFile(home string) string {
...
@@ -116,3 +130,7 @@ func repositoriesFile(home string) string {
func
LocalDirectory
(
home
string
)
string
{
func
LocalDirectory
(
home
string
)
string
{
return
filepath
.
Join
(
home
,
localPath
)
return
filepath
.
Join
(
home
,
localPath
)
}
}
func
LocalDirCacheFile
(
home
string
)
string
{
return
filepath
.
Join
(
home
,
localCacheFilePath
)
}
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