ldap2pg icon indicating copy to clipboard operation
ldap2pg copied to clipboard

Add a flag to treat warnings as errors

Open andersbogsnes opened this issue 5 years ago • 4 comments

When running ldap2pg, it can be useful to be able to upgrade a warning to an error, so that we get a failure. This is a good way to quickly see if something could be wrong with my configuration, while allowing ldap2pg to adopt warnings for corner cases.

andersbogsnes avatar Jun 26 '20 13:06 andersbogsnes

Thanks @andersbogsnes

In #337 , I change a warning to an error. I also changed behaviour on mispelled attribute to raise an error. This make ldap2pg less sloppy.

This is a good reason to implement #286 . It's easy to check for warning if we count them.

@andersbogsnes do you prefer to stop on first warning (i.e. make warning critical) or continue but fail in the end if there has been one or more warning ?

bersace avatar Jun 26 '20 13:06 bersace

If I'm running in strict mode, it's generally because I want to fail fast and get immediate feedback - that is also the behaviour of other tooling, including python:

Sphinx: https://www.sphinx-doc.org/en/master/man/sphinx-build.html (See the -W flag) Python: https://docs.python.org/3/using/cmdline.html#cmdoption-w (when running in -Werror mode)

andersbogsnes avatar Jun 26 '20 14:06 andersbogsnes

Great. So i suggest a --strict switch flag with the YAML counterpart strict: yes. Fail fast on first warning.

bersace avatar Jun 26 '20 15:06 bersace

As of ldap2pg v6, this would apply to the following warning:

  • Bad DN
  • Unexpected DN
  • Reusing unmanaged role

Not for the following warning:

  • Running a prerelease
  • Dry run

By the way, I suggest to replace the following warning by an error

  • Bad verbosity (flags.go)
  • Bad integer (ldap/rc.go)

bersace avatar Oct 18 '23 14:10 bersace