rabbitmq_binding: Fix using empty routing key (#48597)
* rabbitmq_binding: Fix using empty routing key If the routing key is an empty string we need to use the special props value ~ in the URL. Otherwise the last part of the URL will be empty, which will instead be equivalent to the "list all bindings" API call which always returns 200 OK (as long as the exchange and queue exists). * rabbitmq_binding: Move routing_key test outside format Test the routing_key value and set the props value outside the format call. We leave the original routing_key untouched since its original value is later needed in create().
This commit is contained in:
parent
65c7424a35
commit
12c37802e8
1 changed files with 2 additions and 1 deletions
|
@ -108,6 +108,7 @@ class RabbitMqBinding(object):
|
|||
self.verify = self.module.params['cacert']
|
||||
self.cert = self.module.params['cert']
|
||||
self.key = self.module.params['key']
|
||||
self.props = urllib_parse.quote(self.routing_key) if self.routing_key != '' else '~'
|
||||
self.base_url = '{0}://{1}:{2}/api/bindings'.format(self.login_protocol,
|
||||
self.login_host,
|
||||
self.login_port)
|
||||
|
@ -116,7 +117,7 @@ class RabbitMqBinding(object):
|
|||
urllib_parse.quote(self.name, safe=''),
|
||||
self.destination_type,
|
||||
urllib_parse.quote(self.destination, safe=''),
|
||||
urllib_parse.quote(self.routing_key))
|
||||
self.props)
|
||||
self.result = {
|
||||
'changed': False,
|
||||
'name': self.module.params['name'],
|
||||
|
|
Loading…
Reference in a new issue