1
0
mirror of https://github.com/rancher/norman.git synced 2025-09-19 01:17:04 +00:00

Fix bugs in lifecycle

This commit is contained in:
Darren Shepherd
2018-11-26 10:46:11 -07:00
parent 146f45dafa
commit f1c772b7f1
3 changed files with 25 additions and 10 deletions

View File

@@ -349,12 +349,12 @@ func (n *{{.schema.ID}}Client2) Cache() {{.schema.CodeName}}ClientCache {
func (n *{{.schema.ID}}Client2) OnCreate(ctx context.Context, name string, sync {{.schema.CodeName}}ChangeHandlerFunc) {
n.loadController()
n.iface.AddLifecycle(ctx, name, &{{.schema.ID}}LifecycleDelegate{create: sync})
n.iface.AddLifecycle(ctx, name+"-create", &{{.schema.ID}}LifecycleDelegate{create: sync})
}
func (n *{{.schema.ID}}Client2) OnChange(ctx context.Context, name string, sync {{.schema.CodeName}}ChangeHandlerFunc) {
n.loadController()
n.iface.AddLifecycle(ctx, name, &{{.schema.ID}}LifecycleDelegate{update: sync})
n.iface.AddLifecycle(ctx, name+"-change", &{{.schema.ID}}LifecycleDelegate{update: sync})
}
func (n *{{.schema.ID}}Client2) OnRemove(ctx context.Context, name string, sync {{.schema.CodeName}}ChangeHandlerFunc) {
@@ -426,10 +426,6 @@ func (n *{{.schema.ID}}LifecycleDelegate) Remove(obj *{{.prefix}}{{.schema.CodeN
return n.remove(obj)
}
func (n *{{.schema.ID}}LifecycleDelegate) HasUpdated() bool {
return n.remove != nil
}
func (n *{{.schema.ID}}LifecycleDelegate) Updated(obj *{{.prefix}}{{.schema.CodeName}}) (runtime.Object, error) {
if n.update == nil {
return obj, nil