resources: file: Use the computed path in our resource
We compute the actual path in Init() and forget to use it everywhere.
This commit is contained in:
@@ -196,7 +196,7 @@ func (obj *FileRes) GetPath() string {
|
|||||||
// FIXME: Also watch the source directory when using obj.Source !!!
|
// FIXME: Also watch the source directory when using obj.Source !!!
|
||||||
func (obj *FileRes) Watch(processChan chan *event.Event) error {
|
func (obj *FileRes) Watch(processChan chan *event.Event) error {
|
||||||
var err 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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -212,7 +212,7 @@ func (obj *FileRes) Watch(processChan chan *event.Event) error {
|
|||||||
|
|
||||||
for {
|
for {
|
||||||
if obj.debug {
|
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 {
|
select {
|
||||||
@@ -687,7 +687,7 @@ func (obj *FileRes) chmodCheckApply(apply bool) (checkOK bool, _ error) {
|
|||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
st, err := os.Stat(obj.Path)
|
st, err := os.Stat(obj.path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
@@ -702,7 +702,7 @@ func (obj *FileRes) chmodCheckApply(apply bool) (checkOK bool, _ error) {
|
|||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
err = os.Chmod(obj.Path, mode)
|
err = os.Chmod(obj.path, mode)
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -716,7 +716,7 @@ func (obj *FileRes) chownCheckApply(apply bool) (checkOK bool, _ error) {
|
|||||||
return true, nil
|
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
|
// If the file does not exist and we are in
|
||||||
// noop mode, do not throw an error.
|
// noop mode, do not throw an error.
|
||||||
@@ -764,7 +764,7 @@ func (obj *FileRes) chownCheckApply(apply bool) (checkOK bool, _ error) {
|
|||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
err = os.Chown(obj.Path, expectedUID, expectedGID)
|
err = os.Chown(obj.path, expectedUID, expectedGID)
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user