bartavelle / language-puppet

A library to work with Puppet manifests, test them and eventually replace everything ruby.
BSD 3-Clause "New" or "Revised" License
51 stars 8 forks source link

File resource with recursion cannot find files. #272

Closed ppomes closed 5 years ago

ppomes commented 5 years ago

Hi,

Here is a tgz showing a regression with recurse=>true on a File resource. This code is working with puppetresources 1.3.14 (the previous version I was using).

With 1.4.3:

ppomes@haskell ~/testpp adm>: /usr/bin/puppetresources -p . -a allnodes

ERROR: (node1) : Could not find [puppet:///modules/testpp/dir]
                 searched in './modules/testpp/files/dir'

testpp.tar.gz

ppomes commented 5 years ago

image

stat is done on the right directory

bartavelle commented 5 years ago

Right, the code uses doesFileExists, but should also check doesDirectoryExists when recurse is set to True.

Sidenote for when I will be back home to fix this (or if someone checks it first, wink wink), checkAllSources would be more elegant if it used the Validation applicative instead of manually concatenating the failures.

PierreR commented 5 years ago

@bartavelle I have to admit I don't see how to use Validation within IO (yet).

PierreR commented 5 years ago

@ppomes In case you need a workaround while waiting for the fix you can set extratests to false: https://github.com/bartavelle/language-puppet/blob/master/tests/defaults.yaml#L49

bartavelle commented 5 years ago

Does master solve the issue?

ppomes commented 5 years ago

Yes!! thanks, issue can be closed.

PierreR commented 5 years ago

@bartavelle no regression on my side but I quite don't understand the last commit: 1719af114f64beca8fe8563da9b29a99556a5143. Isn't "source" where the filepath would be ?

ppomes commented 5 years ago

@PierreR @bartavelle: Well, I also have the same question!

PierreR commented 5 years ago

@bartavelle actually I am pretty sure there is a regression. Now the tests always pass even when the source of a path is wrong ...

PierreR commented 5 years ago

I can confirm that the latest commit 1719af1 is causing the regression. I have the feeling that after this commit the file test is not effective anymore at least for "source".

bartavelle commented 5 years ago

Oh that is a brainfart over another brainfart. Lemme check this.

bartavelle commented 5 years ago

Also, Validation exists but not ValidationT contrary to what I thought!