From 6209cf39339cd6e39863a949ba08f8013de917ca Mon Sep 17 00:00:00 2001 From: James Shubin Date: Wed, 15 Feb 2017 15:25:03 -0500 Subject: [PATCH] resources: file: Use the computed path in our resource We compute the actual path in Init() and forget to use it everywhere. --- resources/file.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/resources/file.go b/resources/file.go index 2bc1853e..580791d0 100644 --- a/resources/file.go +++ b/resources/file.go @@ -196,7 +196,7 @@ func (obj *FileRes) GetPath() string { // FIXME: Also watch the source directory when using obj.Source !!! func (obj *FileRes) Watch(processChan chan *event.Event) error { var err error - obj.recWatcher, err = recwatch.NewRecWatcher(obj.Path, obj.Recurse) + obj.recWatcher, err = recwatch.NewRecWatcher(obj.path, obj.Recurse) if err != nil { return err } @@ -212,7 +212,7 @@ func (obj *FileRes) Watch(processChan chan *event.Event) error { for { if obj.debug { - log.Printf("%s[%s]: Watching: %s", obj.Kind(), obj.GetName(), obj.Path) // attempting to watch... + log.Printf("%s[%s]: Watching: %s", obj.Kind(), obj.GetName(), obj.path) // attempting to watch... } select { @@ -687,7 +687,7 @@ func (obj *FileRes) chmodCheckApply(apply bool) (checkOK bool, _ error) { return false, err } - st, err := os.Stat(obj.Path) + st, err := os.Stat(obj.path) if err != nil { return false, err } @@ -702,7 +702,7 @@ func (obj *FileRes) chmodCheckApply(apply bool) (checkOK bool, _ error) { return false, nil } - err = os.Chmod(obj.Path, mode) + err = os.Chmod(obj.path, mode) return false, err } @@ -716,7 +716,7 @@ func (obj *FileRes) chownCheckApply(apply bool) (checkOK bool, _ error) { return true, nil } - st, err := os.Stat(obj.Path) + st, err := os.Stat(obj.path) // If the file does not exist and we are in // noop mode, do not throw an error. @@ -764,7 +764,7 @@ func (obj *FileRes) chownCheckApply(apply bool) (checkOK bool, _ error) { return false, nil } - err = os.Chown(obj.Path, expectedUID, expectedGID) + err = os.Chown(obj.path, expectedUID, expectedGID) return false, err }