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
6e63a547
Commit
6e63a547
authored
May 02, 2017
by
Matt Butcher
Committed by
GitHub
May 02, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2354 from technosophos/fix/2271-alternate-toml-marshal
fix(tiller): fix TOML panic
parents
e66cdcd1
46035c35
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
16 deletions
+28
-16
glide.lock
glide.lock
+5
-7
glide.yaml
glide.yaml
+2
-2
files.go
pkg/chartutil/files.go
+7
-5
files_test.go
pkg/chartutil/files_test.go
+14
-2
No files found.
glide.lock
View file @
6e63a547
hash:
e9366bddb36a7120a832959c89f72f75d56b9f10f84820420795c668d9cb0987
updated: 2017-04-2
7T14:23:27.66000871
-06:00
hash:
1933241d076be316f3ef64e587e5400c2c884ebaa68565339796c7803619c8a4
updated: 2017-04-2
8T15:58:28.450420107
-06:00
imports:
- name: bitbucket.org/ww/goautoneg
version: 75cd24fc2f2c2a2088577d12123ddee5f54e0675
...
...
@@ -20,6 +20,8 @@ imports:
version: 3ac7bf7a47d159a033b107610db8a1b6575507a4
subpackages:
- quantile
- name: github.com/BurntSushi/toml
version: b26d9c308763d68093482582cea63d69be07a0f0
- name: github.com/chai2010/gettext-go
version: bf70f2a70fb1b1f36d90d671a72795984eab0fcb
- name: github.com/coreos/go-oidc
...
...
@@ -169,7 +171,7 @@ imports:
- name: github.com/Masterminds/sprig
version: 23597e5f6ad0e4d590e71314bfd0251a4a3cf849
- name: github.com/Masterminds/vcs
version:
795e20f901c3d561de52811fb3488a2cb2c8588b
version:
3084677c2c188840777bff30054f2b553729d329
- name: github.com/mattn/go-runewidth
version: d6bea18f789704b5f83375793155289da36a3c7f
- name: github.com/matttproud/golang_protobuf_extensions
...
...
@@ -180,10 +182,6 @@ imports:
version: ad45545899c7b13c020ea92b2072220eefad42b8
- name: github.com/naoina/go-stringutil
version: 6b638e95a32d0c1131db0e7fe83775cbea4a0d0b
- name: github.com/naoina/toml
version: 751171607256bb66e64c9f0220c00662420c38e9
subpackages:
- ast
- name: github.com/pborman/uuid
version: ca53cad383cad2479bbba7f7a1a05797ec1386e4
- name: github.com/prometheus/client_golang
...
...
glide.yaml
View file @
6e63a547
...
...
@@ -38,8 +38,8 @@ import:
version
:
^0.2.1
-
package
:
github.com/evanphx/json-patch
-
package
:
github.com/facebookgo/symwalk
-
package
:
github.com/
naoina
/toml
version
:
~0.
1
.0
-
package
:
github.com/
BurntSushi
/toml
version
:
~0.
3
.0
-
package
:
github.com/naoina/go-stringutil
version
:
~0.1.0
-
package
:
github.com/chai2010/gettext-go
...
...
pkg/chartutil/files.go
View file @
6e63a547
...
...
@@ -16,6 +16,7 @@ limitations under the License.
package
chartutil
import
(
"bytes"
"encoding/base64"
"encoding/json"
"path"
...
...
@@ -23,9 +24,9 @@ import (
yaml
"gopkg.in/yaml.v2"
"github.com/BurntSushi/toml"
"github.com/gobwas/glob"
"github.com/golang/protobuf/ptypes/any"
"github.com/naoina/toml"
)
// Files is a map of files in a chart that can be accessed from a template.
...
...
@@ -197,12 +198,13 @@ func FromYaml(str string) map[string]interface{} {
//
// This is designed to be called from a template.
func
ToToml
(
v
interface
{})
string
{
data
,
err
:=
toml
.
Marshal
(
v
)
b
:=
bytes
.
NewBuffer
(
nil
)
e
:=
toml
.
NewEncoder
(
b
)
err
:=
e
.
Encode
(
v
)
if
err
!=
nil
{
// Swallow errors inside of a template.
return
""
return
err
.
Error
()
}
return
string
(
data
)
return
b
.
String
(
)
}
// ToJson takes an interface, marshals it to json, and returns a string. It will
...
...
pkg/chartutil/files_test.go
View file @
6e63a547
...
...
@@ -112,9 +112,9 @@ func TestToYaml(t *testing.T) {
}
func
TestToToml
(
t
*
testing
.
T
)
{
expect
:=
"foo
=
\"
bar
\"\n
"
expect
:=
"foo
=
\"
bar
\"\n
"
v
:=
struct
{
Foo
string
`
json
:"foo"`
Foo
string
`
toml
:"foo"`
}{
Foo
:
"bar"
,
}
...
...
@@ -122,6 +122,18 @@ func TestToToml(t *testing.T) {
if
got
:=
ToToml
(
v
);
got
!=
expect
{
t
.
Errorf
(
"Expected %q, got %q"
,
expect
,
got
)
}
// Regression for https://github.com/kubernetes/helm/issues/2271
dict
:=
map
[
string
]
map
[
string
]
string
{
"mast"
:
{
"sail"
:
"white"
,
},
}
got
:=
ToToml
(
dict
)
expect
=
"[mast]
\n
sail =
\"
white
\"\n
"
if
got
!=
expect
{
t
.
Errorf
(
"Expected:
\n
%s
\n
Got
\n
%s
\n
"
,
expect
,
got
)
}
}
func
TestFromYaml
(
t
*
testing
.
T
)
{
...
...
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