Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add -yaml flag #31

Merged
merged 1 commit into from
Jul 7, 2016
Merged

Add -yaml flag #31

merged 1 commit into from
Jul 7, 2016

Conversation

metal3d
Copy link
Contributor

@metal3d metal3d commented Jul 7, 2016

Add a capacity to export as Yaml (see issue #4)

var exp interface{}
// because yaml is not directly usable grom api, we can unmarshal json to interface{}
// and then write yaml file
json.Unmarshal(data, &exp)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason we need to unmarshal the generated json to an interface{} rather than just yaml.Marshal(rc)?

@fkautz
Copy link
Collaborator

fkautz commented Jul 7, 2016

Looks like a bug in yaml when serializing the rc directly, get this:

panic: runtime error: invalid memory address or nil pointer dereference [recovered]
    panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x67d8ff]

goroutine 1 [running]:
panic(0xe7c3a0, 0xc82000e170)
    /home/fkautz/opt/go/src/runtime/panic.go:481 +0x3e6
gopkg.in/yaml%2ev2.handleErr(0xc82008f848)
    /home/fkautz/go/src/gopkg.in/yaml.v2/yaml.go:153 +0xdf
panic(0xe7c3a0, 0xc82000e170)
    /home/fkautz/opt/go/src/runtime/panic.go:443 +0x4e9
k8s.io/kubernetes/pkg/api/unversioned.(*Time).MarshalText(0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
    <autogenerated>:90 +0x4f
gopkg.in/yaml%2ev2.(*encoder).marshal(0xc8201e02c0, 0x0, 0x0, 0xfc3620, 0xc820137de0, 0x196)
    /home/fkautz/go/src/gopkg.in/yaml.v2/encode.go:79 +0xac2
gopkg.in/yaml%2ev2.(*encoder).structv.func1()
    /home/fkautz/go/src/gopkg.in/yaml.v2/encode.go:166 +0x81d
gopkg.in/yaml%2ev2.(*encoder).mappingv(0xc8201e02c0, 0x0, 0x0, 0xc82008ef90)
    /home/fkautz/go/src/gopkg.in/yaml.v2/encode.go:196 +0x181
gopkg.in/yaml%2ev2.(*encoder).structv(0xc8201e02c0, 0x0, 0x0, 0xf83140, 0xc820137d60, 0x199)
    /home/fkautz/go/src/gopkg.in/yaml.v2/encode.go:184 +0x11b
gopkg.in/yaml%2ev2.(*encoder).marshal(0xc8201e02c0, 0x0, 0x0, 0xf83140, 0xc820137d60, 0x199)
    /home/fkautz/go/src/gopkg.in/yaml.v2/encode.go:101 +0xa16
gopkg.in/yaml%2ev2.(*encoder).structv.func1()
    /home/fkautz/go/src/gopkg.in/yaml.v2/encode.go:166 +0x81d
gopkg.in/yaml%2ev2.(*encoder).mappingv(0xc8201e02c0, 0x0, 0x0, 0xc82008f4c0)
    /home/fkautz/go/src/gopkg.in/yaml.v2/encode.go:196 +0x181
gopkg.in/yaml%2ev2.(*encoder).structv(0xc8201e02c0, 0x0, 0x0, 0xef1f60, 0xc820137d40, 0x199)
    /home/fkautz/go/src/gopkg.in/yaml.v2/encode.go:184 +0x11b
gopkg.in/yaml%2ev2.(*encoder).marshal(0xc8201e02c0, 0x0, 0x0, 0xef1f60, 0xc820137d40, 0x199)
    /home/fkautz/go/src/gopkg.in/yaml.v2/encode.go:101 +0xa16
gopkg.in/yaml%2ev2.(*encoder).marshal(0xc8201e02c0, 0x0, 0x0, 0xfbb9e0, 0xc820137d40, 0x16)
    /home/fkautz/go/src/gopkg.in/yaml.v2/encode.go:98 +0x827
gopkg.in/yaml%2ev2.Marshal(0xfbb9e0, 0xc820137d40, 0x0, 0x0, 0x0, 0x0, 0x0)
    /home/fkautz/go/src/gopkg.in/yaml.v2/yaml.go:142 +0x11e
main.main()
    /home/fkautz/go/src/github.com/kelseyhightower/compose2kube/main.go:189 +0x1a12

@fkautz fkautz merged commit 024f8f1 into kelseyhightower:master Jul 7, 2016
@metal3d
Copy link
Contributor Author

metal3d commented Jul 7, 2016

@fkautz That's why I pass to a json marshal before to marshal yaml. Didn't find the problem but it seems that ReplicationController structure isn't construct correctly by api package.

Thanks to have merged my PR ;)

I will continue to try to help your project as I can.

@fkautz
Copy link
Collaborator

fkautz commented Jul 15, 2016

@metal3d if there's a problem with how the RC is constructed, can you open a bug? Thanks :)

@metal3d
Copy link
Contributor Author

metal3d commented Jul 17, 2016

I can :) I only have to find how I will explain the problem ;) Let me a couple of hours to check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants