Fix double decode bug in notifications

Notifications was trying to double decode utf-8 data.

Also, make monasca-ci dir variable.

Change-Id: I95d2008bd313cb813f5341933c4b95390de7cfab
This commit is contained in:
Deklan Dieterly
2015-10-14 16:44:57 -06:00
parent ab0ba6374d
commit 1646647564
2 changed files with 14 additions and 13 deletions

View File

@@ -1227,18 +1227,19 @@ function install_monasca_smoke_test {
sudo tar -xzf /opt/monasca/monasca-ci.tar.gz -C /opt/monasca
sudo sed -i s/192\.168\.10\.4/127\.0\.0\.1/g /opt/monasca/hpcloud-mon-monasca-ci-7a45d29/tests/smoke/utils.py
sudo sed -i s/192\.168\.10\.5/127\.0\.0\.1/g /opt/monasca/hpcloud-mon-monasca-ci-7a45d29/tests/smoke/utils.py
sudo sed -i "s/'hostname', '-f'/'hostname'/g" /opt/monasca/hpcloud-mon-monasca-ci-7a45d29/tests/smoke/smoke_configs.py
HPCLOUD_MON_MONASCA_CI_DIR=$(ls -td /opt/monasca/hpcloud-mon-monasca-ci-* | head -1)
sudo sed -i s/192\.168\.10\.4/127\.0\.0\.1/g ${HPCLOUD_MON_MONASCA_CI_DIR}/tests/smoke/utils.py
sudo sed -i s/192\.168\.10\.5/127\.0\.0\.1/g ${HPCLOUD_MON_MONASCA_CI_DIR}/tests/smoke/utils.py
sudo sed -i "s/'hostname', '-f'/'hostname'/g" ${HPCLOUD_MON_MONASCA_CI_DIR}/tests/smoke/smoke_configs.py
(cd /opt/monasca ; sudo -H ./bin/pip install influxdb)
sudo cp -f /opt/stack/monasca/devstack/files/monasca-smoke-test/smoke2_configs.py /opt/monasca/hpcloud-mon-monasca-ci-7a45d29/tests/smoke/smoke2_configs.py
sudo cp -f /opt/stack/monasca/devstack/files/monasca-smoke-test/smoke2_configs.py ${HPCLOUD_MON_MONASCA_CI_DIR}/tests/smoke/smoke2_configs.py
sudo /opt/monasca/bin/python /opt/monasca/hpcloud-mon-monasca-ci-7a45d29/tests/smoke/smoke2.py || true
(cd /opt/monasca ; LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 OS_USERNAME=test OS_PASSWORD=password OS_PROJECT_NAME=test OS_AUTH_URL=http://127.0.0.1:35357/v3 bash -c 'sudo /opt/monasca/bin/python /opt/monasca/hpcloud-mon-monasca-ci-7a45d29/tests/smoke/smoke.py' || true)
sudo /opt/monasca/bin/python ${HPCLOUD_MON_MONASCA_CI_DIR}/tests/smoke/smoke2.py || true
(cd /opt/monasca ; LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 OS_USERNAME=test OS_PASSWORD=password OS_PROJECT_NAME=test OS_AUTH_URL=http://127.0.0.1:35357/v3 bash -c "sudo /opt/monasca/bin/python ${HPCLOUD_MON_MONASCA_CI_DIR}/tests/smoke/smoke.py")
}
function clean_monasca_smoke_test {

View File

@@ -53,9 +53,9 @@ class Notifications(notifications_api_v2.NotificationsV2API):
@resource.resource_try_catch_block
def _create_notification(self, tenant_id, notification, uri):
name = notification['name'].decode('utf8')
notification_type = notification['type'].upper().decode('utf8')
address = notification['address'].decode('utf8')
name = notification['name']
notification_type = notification['type'].upper()
address = notification['address']
notification_id = self._notifications_repo.create_notification(
tenant_id,
name,
@@ -71,9 +71,9 @@ class Notifications(notifications_api_v2.NotificationsV2API):
@resource.resource_try_catch_block
def _update_notification(self, id, tenant_id, notification, uri):
name = notification['name'].decode('utf8')
notification_type = notification['type'].upper().decode('utf8')
address = notification['address'].decode('utf8')
name = notification['name']
notification_type = notification['type'].upper()
address = notification['address']
self._notifications_repo.update_notification(id, tenant_id, name,
notification_type,
address)