From 32aece6268b147338c8f46126093f6f0ca65f8a0 Mon Sep 17 00:00:00 2001 From: yanyanhu Date: Tue, 18 Oct 2016 23:38:32 -0400 Subject: [PATCH] Fix problem about location header in Zaqar resource2 The name string of location header of Zaqar API response is lower case. This is inconsistent with the guide from API-WG and thus make sdk unable to parse location header correctly. This patch provides a workaround for this issue. Change-Id: I77a474b17aed55b215eb93a3666d444728ded1e9 --- openstack/message/v2/claim.py | 5 +++++ openstack/message/v2/message.py | 5 +++++ openstack/message/v2/queue.py | 5 +++++ openstack/message/v2/subscription.py | 5 +++++ 4 files changed, 20 insertions(+) diff --git a/openstack/message/v2/claim.py b/openstack/message/v2/claim.py index ad95fb20..13585872 100644 --- a/openstack/message/v2/claim.py +++ b/openstack/message/v2/claim.py @@ -17,6 +17,11 @@ from openstack import resource2 class Claim(resource2.Resource): + # FIXME(anyone): The name string of `location` field of Zaqar API response + # is lower case. That is inconsistent with the guide from API-WG. This is + # a workaround for this issue. + location = resource2.Header("location") + resources_key = 'claims' base_path = '/queues/%(queue_name)s/claims' service = message_service.MessageService() diff --git a/openstack/message/v2/message.py b/openstack/message/v2/message.py index 5187aebe..78f21f0b 100644 --- a/openstack/message/v2/message.py +++ b/openstack/message/v2/message.py @@ -17,6 +17,11 @@ from openstack import resource2 class Message(resource2.Resource): + # FIXME(anyone): The name string of `location` field of Zaqar API response + # is lower case. That is inconsistent with the guide from API-WG. This is + # a workaround for this issue. + location = resource2.Header("location") + resources_key = 'messages' base_path = '/queues/%(queue_name)s/messages' service = message_service.MessageService() diff --git a/openstack/message/v2/queue.py b/openstack/message/v2/queue.py index 64619663..49f79f6e 100644 --- a/openstack/message/v2/queue.py +++ b/openstack/message/v2/queue.py @@ -17,6 +17,11 @@ from openstack import resource2 class Queue(resource2.Resource): + # FIXME(anyone): The name string of `location` field of Zaqar API response + # is lower case. That is inconsistent with the guide from API-WG. This is + # a workaround for this issue. + location = resource2.Header("location") + resources_key = "queues" base_path = "/queues" service = message_service.MessageService() diff --git a/openstack/message/v2/subscription.py b/openstack/message/v2/subscription.py index bbf6ffc0..d5acdb05 100644 --- a/openstack/message/v2/subscription.py +++ b/openstack/message/v2/subscription.py @@ -17,6 +17,11 @@ from openstack import resource2 class Subscription(resource2.Resource): + # FIXME(anyone): The name string of `location` field of Zaqar API response + # is lower case. That is inconsistent with the guide from API-WG. This is + # a workaround for this issue. + location = resource2.Header("location") + resources_key = 'subscriptions' base_path = '/queues/%(queue_name)s/subscriptions' service = message_service.MessageService()