Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Boolean values taken from environment variables raise BadArguments #387

Open
amitlt opened this issue Jul 5, 2020 · 1 comment
Open
Assignees
Labels
Milestone

Comments

@amitlt
Copy link

amitlt commented Jul 5, 2020

Describe the bug
Some providers require boolean values to be supplied, like the tls option in the email provider.
If provided through environment variables, these values raise BadArguments exception.
Neither True, TRUE, true, yes or 1 work.

relevant error:

data = self._process_data(**kwargs)
  File "/Users/amitl/ops-lambdas/venv/lib/python3.7/site-packages/notifiers/core.py", line 235, in _process_data

    self._validate_data(data)
  File "/Users/amitl/ops-lambdas/venv/lib/python3.7/site-packages/notifiers/core.py", line 208, in _validate_data

    raise BadArguments(validation_error=msg, provider=self.name, data=data)
notifiers.exceptions.BadArguments: Error with sent data: 'true' is not of type 'boolean'

To Reproduce
Provide a boolean value through environment variables

NOTIFIERS_EMAIL_FROM="[email protected]"
NOTIFIERS_EMAIL_HOST="email-smtp.us-east-1.amazonaws.com"
NOTIFIERS_EMAIL_TLS=true
NOTIFIERS_EMAIL_USERNAME="USERNAME"
NOTIFIERS_EMAIL_PASSWORD="PASSWORD"

Expected behavior
For boolean values to be converted to booleans so they can pass schema check.

Additional context
Python version: 3.8
OS: macos

@liiight liiight added the bug label Jul 7, 2020
@liiight liiight self-assigned this Jul 7, 2020
@liiight liiight added this to the 2.0.0 milestone Jul 7, 2020
@liiight
Copy link
Owner

liiight commented Jul 7, 2020

Nice catch. I'm working on completely rewriting the schema validation logic in #359 , I"ll make sure to add this to that.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants