Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

Commit

Permalink
defile2
Browse files Browse the repository at this point in the history
  • Loading branch information
dacleyra committed Jun 5, 2020
1 parent edcee00 commit a950e37
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/controller/serving/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
//"flag"
// "fmt"
"io/ioutil"
//"log"
// "log"
"path/filepath"

"github.com/elsony/devfile2-registry/tools/types"
Expand All @@ -15,6 +15,7 @@ import (
// genIndex generate new index from meta.yaml files in dir.
// meta.yaml file is expected to be in dir/<stack>/<version>/meta.yaml
func genIndex(dir string) ([]types.MetaIndex, error) {
reqLogger := log.WithValues("Request.Namespace", "", "Request.Name", "")

var index []types.MetaIndex

Expand All @@ -32,13 +33,16 @@ func genIndex(dir string) ([]types.MetaIndex, error) {
for _, versiondir := range versiondirs {
var meta types.Meta
metaFile, err := ioutil.ReadFile(filepath.Join(dir, stackdir.Name(), versiondir.Name(), "meta.yaml"))
reqLogger.Info(filepath.Join(dir, stackdir.Name(), versiondir.Name(), "meta.yaml"))
reqLogger.Info(string(metaFile))
if err != nil {
return nil, err
}
err = yaml.Unmarshal(metaFile, &meta)
if err != nil {
return nil, err
}
reqLogger.Info(fmt.Sprintf("%v", meta)

self := filepath.Join(stackdir.Name(), versiondir.Name(), "devfile.yaml")

Expand All @@ -48,6 +52,7 @@ func genIndex(dir string) ([]types.MetaIndex, error) {
Self: self,
},
}
reqLogger.Info(fmt.Sprintf("%v", metaIndex)
index = append(index, metaIndex)
}
}
Expand Down

0 comments on commit a950e37

Please sign in to comment.