Rewritten code to Python 3
- Docker baseimage change to alpine
- bumped all deps
- skip testing till py36 is available in CI
Change-Id: I7b0ca2b28e2c639645ea07e2b3adb21b857b2fe5
Related-PROD: PRODX-11711
Related-PROD: PRODX-14584
diff --git a/sf_notifier/helpers.py b/sf_notifier/helpers.py
index b425de4..9715545 100644
--- a/sf_notifier/helpers.py
+++ b/sf_notifier/helpers.py
@@ -1,18 +1,3 @@
-# Copyright 2018: Mirantis Inc.
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
import os
RESOLVED_STATUSES = ('UP', 'OK', 'resolved')
diff --git a/sf_notifier/salesforce/client.py b/sf_notifier/salesforce/client.py
index 766d3d7..4403528 100644
--- a/sf_notifier/salesforce/client.py
+++ b/sf_notifier/salesforce/client.py
@@ -1,18 +1,3 @@
-# Copyright 2018: Mirantis Inc.
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
import fcntl
import hashlib
import logging
@@ -116,7 +101,7 @@
def _validate_config(config):
kwargs = {}
- for param, field in CONFIG_FIELD_MAP.iteritems():
+ for param, field in CONFIG_FIELD_MAP.items():
setting_var = param.upper()
env_var = 'SFDC_{}'.format(setting_var)
kwargs[field] = os.environ.get(
@@ -217,7 +202,7 @@
alert_id_data = ''
for key in sorted(labels):
alert_id_data += labels[key].replace(".", "\\.")
- return self.hash_func(alert_id_data).hexdigest()
+ return self.hash_func(alert_id_data.encode('utf-8')).hexdigest()
@sf_auth_retry
def _create_case(self, subject, body, labels, alert_id):
diff --git a/sf_notifier/server.py b/sf_notifier/server.py
index 92144b8..8077627 100644
--- a/sf_notifier/server.py
+++ b/sf_notifier/server.py
@@ -1,18 +1,3 @@
-# Copyright 2018: Mirantis Inc.
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
import json
from logging.config import dictConfig
@@ -29,7 +14,7 @@
from simple_settings import settings
-from werkzeug.wsgi import DispatcherMiddleware
+from werkzeug.middleware.dispatcher import DispatcherMiddleware
dictConfig(settings.LOGGING)