fix: Make sure boto installed (#4835)

Signed-off-by: koooge <koooooge@gmail.com>
This commit is contained in:
koooge
2020-04-25 11:34:45 +02:00
committed by GitHub
parent 60f92a2efc
commit de6d665c6e
2 changed files with 20 additions and 4 deletions

View File

@@ -1,10 +1,14 @@
import boto3
import yaml
import datetime
from redash.query_runner import BaseQueryRunner, register
from redash.utils import json_dumps, parse_human_time
try:
import boto3
enabled = True
except ImportError:
enabled = False
def parse_response(results):
columns = [
@@ -63,6 +67,10 @@ class CloudWatch(BaseQueryRunner):
"secret": ["aws_secret_key"],
}
@classmethod
def enabled(cls):
return enabled
def __init__(self, configuration):
super(CloudWatch, self).__init__(configuration)
self.syntax = "yaml"

View File

@@ -1,13 +1,17 @@
import boto3
import yaml
import datetime
import time
from botocore.exceptions import ParamValidationError
from redash.query_runner import BaseQueryRunner, register
from redash.utils import json_dumps, parse_human_time
try:
import boto3
from botocore.exceptions import ParamValidationError
enabled = True
except ImportError:
enabled = False
POLL_INTERVAL = 3
TIMEOUT = 180
@@ -81,6 +85,10 @@ class CloudWatchInsights(BaseQueryRunner):
"secret": ["aws_secret_key"],
}
@classmethod
def enabled(cls):
return enabled
def __init__(self, configuration):
super(CloudWatchInsights, self).__init__(configuration)
self.syntax = "yaml"