lelutin / puppet-fail2ban

Manage fail2ban and its jails with puppet
GNU General Public License v3.0
8 stars 30 forks source link

Using deprecated validation functions #26

Closed alisonjenkins closed 6 years ago

alisonjenkins commented 7 years ago

Hey Lelutin,

The module is currently using validation functions that have been deprecated in puppet stdlib.

https://github.com/puppetlabs/puppetlabs-stdlib#validate_re https://github.com/puppetlabs/puppetlabs-stdlib#validate_bool https://github.com/puppetlabs/puppetlabs-stdlib#validate_array

We should switch to defining the data types for passed in parameters which eliminates the need to use array and bool. For the re we could just switch to using if statements.

I will try and find some time to make these improvements for you.

Thanks,

Alan Jenkins

lelutin commented 7 years ago

I have seen this issue, too in debian stretch (puppet 4.8.2). thanks for reporting it!

I'm wondering how we can come up with a fix that would stay compatible with 3.x. the fix for 4.x would be to use parameter types instead of the validate_* functions but those don't work in 3.x

olifre commented 6 years ago

Since this was changed, I now get a fatal error with Puppet 5.4.0 which was working fine before:

Info: Retrieving locales
Info: Loading facts
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Error while evaluating a Function Call, private method `load' called for Scope(Class[Fail2ban]):Puppet::Parser::Scope (file: /etc/puppetlabs/code/environments/production/modules/fail2ban/manifests/init.pp, line: 27, column: 3) on node XXXXX.XXXXX.XXXXX
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
lelutin commented 6 years ago

oh no! I don't have access to 5.x puppet clients so I haven't tested it with this version.

@olifre this line is about validating that $ignoreip is an array. I'm curious how you're currently calling the fail2ban module. are you defining a value for ignoreip? (I would expect a type error clearly stated though if the type was wrong.. not a weird method error)

lelutin commented 6 years ago

hmm comments on all issues. I got lost and didn't see that you had opened another one already. I'll close this one and repeat my question on the other one so that we follow up there.