From 1b97ed3ca759a530585a520c8edd01e26bdee582 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 5 Jul 2026 10:48:52 +0300 Subject: initial work for a central applier algo --- internal/resource/link/link.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'internal/resource/link/link.go') diff --git a/internal/resource/link/link.go b/internal/resource/link/link.go index f9c6c8d..5f8e345 100644 --- a/internal/resource/link/link.go +++ b/internal/resource/link/link.go @@ -18,10 +18,11 @@ const ( ) type Link struct { - path string - target string - kind kind - absent bool + resource resource.Resource + path string + target string + kind kind + absent bool } // SetSymlink implements opt.Linkable. @@ -87,13 +88,14 @@ func Ensure(path string, opts ...opt.Option) error { func Have(path string, opts ...opt.Option) resource.Resource { l := build(path, opts...) - res := resource.Register(l.resourceType(), l.path) + l.resource = resource.Register(l.resourceType(), l.path, + resource.ApplierFunc(func() error { return l.apply() })) if err := l.apply(); err != nil { log.Fatalf("failed to apply link resource %s: %v", path, err) } - return res + return l.resource } func Absent(path string, opts ...opt.Option) resource.Resource { -- cgit v1.2.3