Curl statements to include globoff for IPv6 URLs

python-heatclient displays curl statements for debugging/troubleshooting
purposes. For IPv6 URLs, curl requires --globoff to be passed in the
arguments. Since heatclient does not use curl directly, this patch
displays the curl commands with globoff option which works for both
IPv4 and IPv6 URLs.
Fix adapted from python-novaclient Ib7099e8e3bbc15f29bbaa1db37ef21e78a74e7bc

Closes-Bug: #1228744
Change-Id: I1ace9268b09e6fc0d0c0ff02ce1f2e31940d961d
This commit is contained in:
sridhargaddam
2014-11-21 13:11:38 +00:00
parent e6949d0c48
commit 0d69f021d9
2 changed files with 3 additions and 3 deletions

View File

@@ -95,7 +95,7 @@ class HTTPClient(object):
return strutils.safe_decode(name), strutils.safe_decode(value)
def log_curl_request(self, method, url, kwargs):
curl = ['curl -i -X %s' % method]
curl = ['curl -g -i -X %s' % method]
for (key, value) in kwargs['headers'].items():
header = '-H \'%s: %s\'' % self.safe_header(key, value)

View File

@@ -581,7 +581,7 @@ class HttpClientTest(testtools.TestCase):
headers = {'key': 'value'}
mock_logging_debug = logging.Logger.debug(
"curl -i -X GET -H 'key: value' --key TEST_KEY "
"curl -g -i -X GET -H 'key: value' --key TEST_KEY "
"--cert TEST_CERT --cacert TEST_CA "
"-k -d 'text' http://foo/bar"
)
@@ -672,7 +672,7 @@ class HttpClientTest(testtools.TestCase):
kwargs = {'headers': {'Key': b'foo\xe3\x8a\x8e'}}
mock_logging_debug = logging.Logger.debug(
u"curl -i -X GET -H 'Key: foo㊎' http://somewhere"
u"curl -g -i -X GET -H 'Key: foo㊎' http://somewhere"
)
mock_logging_debug.AndReturn(None)