func()

in pkg/rule_dir_exist.go [23:38]


func (d *DirExistRule) ExecuteDuringPlan() error {
	fs := FsFactory()
	exists, err := afero.Exists(fs, d.Dir)
	if err != nil {
		return err
	}
	if d.FailOnExist && exists {
		d.setCheckError(fmt.Errorf("directory exists: %s", d.Dir))
		return nil
	}
	if !d.FailOnExist && !exists {
		d.setCheckError(fmt.Errorf("directory does not exist: %s", d.Dir))
		return nil
	}
	return nil
}