Compare commits

...

5 Commits

Author SHA1 Message Date
Arik Fraimovich
14ea79b1e9 Fix build configuration 2016-08-02 14:02:30 +03:00
Arik Fraimovich
432fe9b8a3 Update version 2016-08-02 13:59:06 +03:00
Arik Fraimovich
33909a1b32 Skip email sending if there are no recipients 2016-08-02 13:56:39 +03:00
Arik Fraimovich
9bca3933e7 Fix #1212: email alerts not being sent 2016-08-02 13:56:22 +03:00
Arik Fraimovich
e1dd1b3f71 Update cirlce.yml to build release_* branches 2016-08-02 13:51:05 +03:00
6 changed files with 14 additions and 12 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "redash",
"version": "0.11.0",
"version": "0.11.1",
"dependencies": {
"angular": "1.2.18",
"angular-resource": "1.2.18",

View File

@@ -12,17 +12,16 @@ dependencies:
- pip install -r requirements_dev.txt
- pip install -r requirements.txt
- pip install pymongo==3.2.1
- if [ "$CIRCLE_BRANCH" = "master" ]; then make deps; fi
- make deps
cache_directories:
- node_modules/
- rd_ui/node_modules/
- rd_ui/app/bower_components/
test:
override:
- nosetests --with-xunit --xunit-file=$CIRCLE_TEST_REPORTS/junit.xml --with-coverage --cover-package=redash tests/
deployment:
github_and_docker:
branch: master
branch: [master, /release_.*/]
commands:
- make pack
- make upload

View File

@@ -13,7 +13,7 @@ from redash.query_runner import import_query_runners
from redash.destinations import import_destinations
__version__ = '0.11.0'
__version__ = '0.11.1'
if settings.FEATURE_TABLES_PERMISSIONS:

View File

@@ -24,7 +24,11 @@ class Email(BaseDestination):
return 'fa-envelope'
def notify(self, alert, query, user, new_state, app, host, options):
recipients = [email for email in options.get('addresses').split(',') if email]
recipients = [email for email in options.get('addresses', '').split(',') if email]
if not recipients:
logging.warning("No emails given. Skipping send.")
html = """
Check <a href="{host}/alerts/{alert_id}">alert</a> / check <a href="{host}/queries/{query_id}">query</a>.
""".format(host=host, alert_id=alert.id, query_id=query.id)
@@ -39,6 +43,6 @@ class Email(BaseDestination):
)
mail.send(message)
except Exception:
logging.exception("mail send ERROR.")
logging.exception("Mail send error.")
register(Email)

View File

@@ -1189,12 +1189,11 @@ class AlertSubscription(ModelTimestampsMixin, BaseModel):
app, host)
else:
# User email subscription, so create an email destination object
config = {'email': self.user.email}
config = {'addresses': self.user.email}
schema = get_configuration_schema_for_destination_type('email')
options = ConfigurationContainer(json.dumps(config), schema)
options = ConfigurationContainer(config, schema)
destination = get_destination('email', options)
return destination.notify(alert, query, user, new_state,
app, host, options)
return destination.notify(alert, query, user, new_state, app, host, options)
all_models = (Organization, Group, DataSource, DataSourceGroup, User, QueryResult, Query, Alert, Dashboard, Visualization, Widget, Event, NotificationDestination, AlertSubscription, ApiKey)

View File

@@ -42,5 +42,5 @@ def check_alerts_for_query(query_id):
try:
subscription.notify(alert, query, subscription.user, new_state, app, host)
except Exception as e:
logger.warn("Exception: {}".format(e))
logger.exception("Error with processing destination")