From 0d69f021d961c0458d93bcbecdfbe5e53434cf0c Mon Sep 17 00:00:00 2001 From: sridhargaddam Date: Fri, 21 Nov 2014 13:11:38 +0000 Subject: [PATCH] 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 --- heatclient/common/http.py | 2 +- heatclient/tests/test_common_http.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/heatclient/common/http.py b/heatclient/common/http.py index 1659f71d..2239908f 100644 --- a/heatclient/common/http.py +++ b/heatclient/common/http.py @@ -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) diff --git a/heatclient/tests/test_common_http.py b/heatclient/tests/test_common_http.py index d7743ff8..55a14297 100644 --- a/heatclient/tests/test_common_http.py +++ b/heatclient/tests/test_common_http.py @@ -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)