diff --git a/engine/resources.go b/engine/resources.go index 92e933ad..bd09bdae 100644 --- a/engine/resources.go +++ b/engine/resources.go @@ -376,14 +376,6 @@ type CompatibleRes interface { Merge(CompatibleRes) (CompatibleRes, error) } -// CollectableRes is an interface for resources that support collection. It is -// currently temporary until a proper API for all resources is invented. -type CollectableRes interface { - Res - - CollectPattern(string) // XXX: temporary until Res collection is more advanced -} - // YAMLRes is a resource that supports creation by unmarshalling. type YAMLRes interface { Res diff --git a/engine/resources/file.go b/engine/resources/file.go index 2a9d5791..2264f1f9 100644 --- a/engine/resources/file.go +++ b/engine/resources/file.go @@ -1501,12 +1501,6 @@ func (obj *FileRes) UIDs() []engine.ResUID { // return fmt.Errorf("not possible at the moment") //} -// CollectPattern applies the pattern for collection resources. -func (obj *FileRes) CollectPattern(pattern string) { - // XXX: currently the pattern for files can only override the Dirname variable :P - obj.Dirname = pattern // XXX: simplistic for now -} - // UnmarshalYAML is the custom unmarshal handler for this struct. It is // primarily useful for setting the defaults. func (obj *FileRes) UnmarshalYAML(unmarshal func(interface{}) error) error { diff --git a/yamlgraph/gapi.go b/yamlgraph/gapi.go index d398fb4e..d823359b 100644 --- a/yamlgraph/gapi.go +++ b/yamlgraph/gapi.go @@ -30,7 +30,6 @@ package yamlgraph import ( - "context" "fmt" "sync" @@ -170,8 +169,8 @@ func (obj *GAPI) Next() chan gapi.Next { return } // FIXME: add timeout to context - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() + //ctx, cancel := context.WithCancel(context.Background()) + //defer cancel() startChan := make(chan struct{}) // start signal close(startChan) // kick it off! @@ -180,16 +179,17 @@ func (obj *GAPI) Next() chan gapi.Next { if obj.data.NoStreamWatch { watchChan = nil } else { - var err error - watchChan, err = obj.data.World.ResWatch(ctx) - if err != nil { - next := gapi.Next{ - Err: errwrap.Wrapf(err, "%s: could not start watch", Name), - Exit: true, // exit, b/c programming error? - } - ch <- next - return - } + // XXX: disabled for now until someone ports to new API. + //var err error + //watchChan, err = obj.data.World.ResWatch(ctx) + //if err != nil { + // next := gapi.Next{ + // Err: errwrap.Wrapf(err, "%s: could not start watch", Name), + // Exit: true, // exit, b/c programming error? + // } + // ch <- next + // return + //} } for { diff --git a/yamlgraph/gconfig.go b/yamlgraph/gconfig.go index 7693dbde..953a1a16 100644 --- a/yamlgraph/gconfig.go +++ b/yamlgraph/gconfig.go @@ -32,7 +32,6 @@ package yamlgraph import ( - "context" "fmt" "strings" @@ -239,12 +238,13 @@ func (obj *GraphConfig) NewGraphFromConfig(hostname string, world engine.World, } // store in backend (usually etcd) - if err := world.ResExport(context.TODO(), resourceList); err != nil { - return nil, fmt.Errorf("config: could not export resources: %v", err) - } + // XXX: disabled for now until someone ports to new API. + //if err := world.ResExport(context.TODO(), resourceList); err != nil { + // return nil, fmt.Errorf("config: could not export resources: %v", err) + //} // lookup from backend (usually etcd) - var hostnameFilter []string // empty to get from everyone + //var hostnameFilter []string // empty to get from everyone kindFilter := []string{} for _, t := range obj.Collector { kind := strings.ToLower(t.Kind) @@ -253,11 +253,12 @@ func (obj *GraphConfig) NewGraphFromConfig(hostname string, world engine.World, // do all the graph look ups in one single step, so that if the backend // database changes, we don't have a partial state of affairs... if len(kindFilter) > 0 { // if kindFilter is empty, don't need to do lookups! - var err error - resourceList, err = world.ResCollect(context.TODO(), hostnameFilter, kindFilter) - if err != nil { - return nil, fmt.Errorf("config: could not collect resources: %v", err) - } + // XXX: disabled for now until someone ports to new API. + //var err error + //resourceList, err = world.ResCollect(context.TODO(), hostnameFilter, kindFilter) + //if err != nil { + // return nil, fmt.Errorf("config: could not collect resources: %v", err) + //} } for _, res := range resourceList { matched := false @@ -283,11 +284,12 @@ func (obj *GraphConfig) NewGraphFromConfig(hostname string, world engine.World, // res.MetaParams().Noop = noop //} - if t.Pattern != "" { // XXX: simplistic for now - if xres, ok := res.(engine.CollectableRes); ok { - xres.CollectPattern(t.Pattern) // res.Dirname = t.Pattern - } - } + // XXX: disabled for now until someone ports to new API. + //if t.Pattern != "" { // XXX: simplistic for now + // if xres, ok := res.(engine.CollectableRes); ok { + // xres.CollectPattern(t.Pattern) // res.Dirname = t.Pattern + // } + //} obj.Logf("collected: %s", res)