[rabbitmq_binding] Fix the quoting of vhost and other names (#45109)

* [rabbitmq_binding] Fix the quoting of vhost and other names, which was broken in PR #35651
* Merge missing urllib_parse.quote from PR #42422
* Missed one line, where  also needs to be escaped, i.e., the destination
This commit is contained in:
Tobias Wolf 2018-09-25 07:34:41 +02:00 committed by Abhijeet Kasurde
parent e74e8b8e75
commit d5f8738bf2

View file

@ -125,11 +125,11 @@ class RabbitMqBinding(object):
self.base_url = 'http://{0}:{1}/api/bindings'.format(self.login_host,
self.login_port)
self.url = '{0}/{1}/e/{2}/{3}/{4}/{5}'.format(self.base_url,
urllib_parse.quote(self.vhost),
urllib_parse.quote(self.name),
urllib_parse.quote(self.vhost, safe=''),
urllib_parse.quote(self.name, safe=''),
self.destination_type,
self.destination,
self.routing_key)
urllib_parse.quote(self.destination, safe=''),
urllib_parse.quote(self.routing_key))
self.result = {
'changed': False,
'name': self.module.params['name'],
@ -247,10 +247,10 @@ class RabbitMqBinding(object):
:return:
"""
self.url = '{0}/{1}/e/{2}/{3}/{4}'.format(self.base_url,
urllib_parse.quote(self.vhost),
urllib_parse.quote(self.name),
urllib_parse.quote(self.vhost, safe=''),
urllib_parse.quote(self.name, safe=''),
self.destination_type,
urllib_parse.quote(self.destination))
urllib_parse.quote(self.destination, safe=''))
self.api_result = self.request.post(self.url,
auth=self.authentication,
headers={"content-type": "application/json"},