Skip to content

Commit

Permalink
convert unstructured objs before exporting
Browse files Browse the repository at this point in the history
  • Loading branch information
juanvallejo committed Oct 5, 2017
1 parent e158a97 commit 11d6a4c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pkg/oc/cli/cmd/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,19 @@ func RunExport(f *clientcmd.Factory, exporter Exporter, in io.Reader, out io.Wri
newInfos := []*resource.Info{}
errs := []error{}
for _, info := range infos {
// convert unstructured object to runtime.Object
data, err := runtime.Encode(kapi.Codecs.LegacyCodec(), info.Object)
if err != nil {
errs = append(errs, err)
continue
}
decoded, err := runtime.Decode(kapi.Codecs.UniversalDecoder(), data)
if err == nil {
// ignore error, if any, in order to allow resources
// not known by the client to still be exported
info.Object = decoded
}

if err := exporter.Export(info.Object, exact); err != nil {
if err == ErrExportOmit {
continue
Expand Down

0 comments on commit 11d6a4c

Please sign in to comment.