rebased and changed io helpers to use new API groups

This commit is contained in:
markturansky 2015-09-15 13:26:49 -04:00
parent 7bc55b5aea
commit bd4705c414
2 changed files with 5 additions and 4 deletions

View File

@ -38,7 +38,8 @@ func LoadPodFromFile(filePath string) (*api.Pod, error) {
return nil, fmt.Errorf("file was empty: %s", filePath) return nil, fmt.Errorf("file was empty: %s", filePath)
} }
pod := &api.Pod{} pod := &api.Pod{}
if err := latest.Codec.DecodeInto(podDef, pod); err != nil {
if err := latest.GroupOrDie("").Codec.DecodeInto(podDef, pod); err != nil {
return nil, fmt.Errorf("failed decoding file: %v", err) return nil, fmt.Errorf("failed decoding file: %v", err)
} }
return pod, nil return pod, nil
@ -49,7 +50,7 @@ func SavePodToFile(pod *api.Pod, filePath string, perm os.FileMode) error {
if filePath == "" { if filePath == "" {
return fmt.Errorf("file path not specified") return fmt.Errorf("file path not specified")
} }
data, err := latest.Codec.Encode(pod) data, err := latest.GroupOrDie("").Codec.Encode(pod)
if err != nil { if err != nil {
return fmt.Errorf("failed encoding pod: %v", err) return fmt.Errorf("failed encoding pod: %v", err)
} }

View File

@ -30,8 +30,8 @@ func TestSavePodToFile(t *testing.T) {
pod := volume.NewPersistentVolumeRecyclerPodTemplate() pod := volume.NewPersistentVolumeRecyclerPodTemplate()
// sets all default values on a pod for equality comparison after decoding from file // sets all default values on a pod for equality comparison after decoding from file
encoded, err := latest.Codec.Encode(pod) encoded, err := latest.GroupOrDie("").Codec.Encode(pod)
latest.Codec.DecodeInto(encoded, pod) latest.GroupOrDie("").Codec.DecodeInto(encoded, pod)
path := fmt.Sprintf("/tmp/kube-io-test-%s", uuid.New()) path := fmt.Sprintf("/tmp/kube-io-test-%s", uuid.New())
defer os.Remove(path) defer os.Remove(path)