the unit test do not have the correct user_agent
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Tricircle |
Fix Released
|
High
|
Unassigned |
Bug Description
INFO neutron.wsgi [None req-061e4d66-
> /opt/stack/
-> if source_header in cons.REQUEST_
(Pdb) p source_header
'openstacksdk/
(Pdb) l
33
34 def distinguish_
35 source_header = req.headers.
36 import pdb
37 pdb.set_trace()
38 -> if source_header in cons.REQUEST_
39 ctx = req.environ[
40 ctx.USER_AGENT = source_header
41 req.environ[
42
43 @webob.dec.wsgify
(Pdb) p source_header
'openstacksdk/
like above all the request from unit test will not in cons.REQUEST_
so all the request will do not know whether come for user or from local neturon .
Changed in tricircle: | |
importance: | Undecided → High |
status: | New → Confirmed |
Changed in tricircle: | |
status: | Confirmed → Fix Released |
it is look like a throuble.
in resource2.py openstack generate the post methond base on the session,but it do not
pass the user-agent para.
response = session. post(request. uri, endpoint_ filter= self.service,
json=request. body, headers= request. headers)
even in the session.py the function have allow to pass the user_agent para.like below.
def request(self, url, method, json=None, original_ip=None,
user_ agent=None, redirect=None, authenticated=None,
endpoint_ filter= None, auth=None, requests_auth=None,
raise_ exc=True, allow_reauth=True, log=True,
endpoint_ override= None, connect_retries=0, logger=_logger,
allow= None, client_name=None, client_ version= None,
microversion= None, microversion_ service_ type=None,
**kwargs) :
so even we set the usr-agent in the headers is also no use, because like below:
the request will rewrite the user-agent, which we have set it before this.
if user_agent:
headers[ 'User-Agent' ] = user_agent
user_ agent = headers. setdefault( 'User-Agent' , self.user_agent)
elif self.user_agent: