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
a9c10fe1
Commit
a9c10fe1
authored
Mar 08, 2019
by
Joe Lanford
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pkg/chartutil: fix SaveDir for nested templates directories
Signed-off-by:
Joe Lanford
<
joe.lanford@gmail.com
>
parent
367b6fc1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
0 deletions
+21
-0
save.go
pkg/chartutil/save.go
+6
-0
save_test.go
pkg/chartutil/save_test.go
+15
-0
No files found.
pkg/chartutil/save.go
View file @
a9c10fe1
...
...
@@ -63,6 +63,12 @@ func SaveDir(c *chart.Chart, dest string) error {
// Save templates
for
_
,
f
:=
range
c
.
Templates
{
n
:=
filepath
.
Join
(
outdir
,
f
.
Name
)
d
:=
filepath
.
Dir
(
n
)
if
err
:=
os
.
MkdirAll
(
d
,
0755
);
err
!=
nil
{
return
err
}
if
err
:=
ioutil
.
WriteFile
(
n
,
f
.
Data
,
0644
);
err
!=
nil
{
return
err
}
...
...
pkg/chartutil/save_test.go
View file @
a9c10fe1
...
...
@@ -48,6 +48,9 @@ func TestSave(t *testing.T) {
Files
:
[]
*
any
.
Any
{
{
TypeUrl
:
"scheherazade/shahryar.txt"
,
Value
:
[]
byte
(
"1,001 Nights"
)},
},
Templates
:
[]
*
chart
.
Template
{
{
Name
:
"templates/scheherazade/shahryar.txt.tmpl"
,
Data
:
[]
byte
(
"{{
\"
1,001 Nights
\"
}}"
)},
},
}
where
,
err
:=
Save
(
c
,
tmp
)
...
...
@@ -75,6 +78,9 @@ func TestSave(t *testing.T) {
if
len
(
c2
.
Files
)
!=
1
||
c2
.
Files
[
0
]
.
TypeUrl
!=
"scheherazade/shahryar.txt"
{
t
.
Fatal
(
"Files data did not match"
)
}
if
len
(
c2
.
Templates
)
!=
1
||
c2
.
Templates
[
0
]
.
Name
!=
"templates/scheherazade/shahryar.txt.tmpl"
{
t
.
Fatal
(
"Templates data did not match"
)
}
}
func
TestSavePreservesTimestamps
(
t
*
testing
.
T
)
{
...
...
@@ -100,6 +106,9 @@ func TestSavePreservesTimestamps(t *testing.T) {
Files
:
[]
*
any
.
Any
{
{
TypeUrl
:
"scheherazade/shahryar.txt"
,
Value
:
[]
byte
(
"1,001 Nights"
)},
},
Templates
:
[]
*
chart
.
Template
{
{
Name
:
"templates/scheherazade/shahryar.txt.tmpl"
,
Data
:
[]
byte
(
"{{
\"
1,001 Nights
\"
}}"
)},
},
}
where
,
err
:=
Save
(
c
,
tmp
)
...
...
@@ -171,6 +180,9 @@ func TestSaveDir(t *testing.T) {
Files
:
[]
*
any
.
Any
{
{
TypeUrl
:
"scheherazade/shahryar.txt"
,
Value
:
[]
byte
(
"1,001 Nights"
)},
},
Templates
:
[]
*
chart
.
Template
{
{
Name
:
"templates/scheherazade/shahryar.txt.tmpl"
,
Data
:
[]
byte
(
"{{
\"
1,001 Nights
\"
}}"
)},
},
}
if
err
:=
SaveDir
(
c
,
tmp
);
err
!=
nil
{
...
...
@@ -191,4 +203,7 @@ func TestSaveDir(t *testing.T) {
if
len
(
c2
.
Files
)
!=
1
||
c2
.
Files
[
0
]
.
TypeUrl
!=
"scheherazade/shahryar.txt"
{
t
.
Fatal
(
"Files data did not match"
)
}
if
len
(
c2
.
Templates
)
!=
1
||
c2
.
Templates
[
0
]
.
Name
!=
"templates/scheherazade/shahryar.txt.tmpl"
{
t
.
Fatal
(
"Templates data did not match"
)
}
}
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