rcbops-cookbooks/osops-utils — pull request #116 by mancdaz (2013-07-19 08:50:48+00:00)
Title: allow passing of a URI containing a '%' when overriding and endpoint

Partial fix for issue #DE200
Partially addresses rcbops/chef-cookbooks#463

Certain endpoint "uri's" need to contain a %, so that the tenant_id can be substituted in by the client using the endpoint, after it has been retrieved from keystone. A typical cinder endpoint might look like:

http://192.168.3.2:8776/v1/%(tenant_id)s

When passing an entire uri in the environment for an endpoint type to be used as an override, we also split it into it's component parts (scheme, host, port, path) so that these can be used elsewhere in the recipes. Unfortunately, a uri containing a '%' is not a valid uri, and so the ruby URI class fails to parse it.

This commit simply temporarily subs any '%' for a string of 10 'x' so that URI can parse the uri properly, and split it out into it's component parts. The '%' is then subbed back in after the split. The original full uri is left untouched.