Connecting to ceilometer using proxy_url fails
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
python-ceilometerclient |
New
|
Undecided
|
Unassigned |
Bug Description
The BUG:
-----
- When using ceilometerclient with a proxy-url to connect to a ceilometer server (as part of devstack) connection fails with HTTP response 406 (Not acceptable)
Looking into code/details --> the code creates the correct connection using the function get_proxy_url from common/http.py (which tunnels the code to the proxy:8777 end-point) but the function _http_request is creating the bug by::
after creating the connection using "conn = self.get_
the code adds "self.endpoint.
WORKAROUND:
-------
One possible workaround is just to remove the lines in the code that adds that unneeded end-point, so the code for ceilometer\
.
def _http_request(self, url, method, **kwargs):
"""Send an http request with the specified characteristics.
Wrapper around httplib.
as setting headers and error handling.
"""
# Copy the kwargs so we can reuse the original in case of redirects
auth_token = self.auth_token()
if auth_token:
conn = self.get_
try:
#if self.proxy_url:
# conn_url = (self.endpoint.
# self._make_
#else:
resp = conn.getresponse()
ENVIRONMENT:
------
The code was tested with the following configuration (before and after fix)
a devstack machine (with ceilometer service enabled ) is running on the proxy machine in a virtual box (using NAT configuration) and port forward for ports 5000 and 8777 and ceilometerclient is running against that code from remote machine.
Addendum, for the WORKAROUND:
Need to also change function get_connection to reflect original :8777 port (using the original not the proxy :5000 port) i.e:
def get_connection( self): _params[ 0]
proxy_ parts = parse.urlparse( self.proxy_ url)
return _class( proxy_parts. hostname, *self.connectio n_params[ 1][1:2] ,
**self. connection_ params[ 2])
return _class( *self.connectio n_params[ 1][0:2] ,
**self. connection_ params[ 2]) oint()
_class = self.connection
try:
if self.proxy_url:
else:
except httplib.InvalidURL:
raise exc.InvalidEndp