Skip to content
This repository has been archived by the owner on Jun 17, 2022. It is now read-only.

Commit

Permalink
fix bug where only the first of multiple input manifests was read
Browse files Browse the repository at this point in the history
  • Loading branch information
imsky committed Apr 6, 2018
1 parent 2037180 commit b14c55a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
7 changes: 4 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ func parseManifests(file string) ([]runtime.Object, error) {
if len(m) == 0 {
continue
}
obj, _, err := scheme.Codecs.UniversalDeserializer().Decode([]byte(file), nil, nil)

obj, _, err := scheme.Codecs.UniversalDeserializer().Decode([]byte(m), nil, nil)

if err != nil {
return nil, err
Expand Down Expand Up @@ -184,8 +185,8 @@ func main() {
files := readFiles(filenames)
localObjects := make([]runtime.Object, 0, 1)

for _, file := range files {
o, err := parseManifests(file)
for i := range files {
o, err := parseManifests(files[i])
if err != nil {
panic(err)
}
Expand Down
7 changes: 3 additions & 4 deletions plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,15 @@ func pairObjectsByCriteria(srcObjects []runtime.Object, dstObjects []runtime.Obj
srcMetadata, srcLabels := getObjectMetadata(srcObjects[i])
pair := ObjectPair{&srcObjects[i], nil}

for _, dst := range dstObjects {
dstMetadata, dstLabels := getObjectMetadata(dst)
for j := range dstObjects {
dstMetadata, dstLabels := getObjectMetadata(dstObjects[j])

if criteria.label != "" &&
srcLabels.Get(criteria.label) == dstLabels.Get(criteria.label) &&
srcMetadata.GetNamespace() == dstMetadata.GetNamespace() {
pair.dst = &dst
pair.dst = &dstObjects[j]
}
}

pairs = append(pairs, pair)
}

Expand Down

0 comments on commit b14c55a

Please sign in to comment.