Comment 7 for bug 1611426

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to keystoneauth (master)

Reviewed: https://review.openstack.org/352673
Committed: https://git.openstack.org/cgit/openstack/keystoneauth/commit/?id=4a0ac4583b5e896d5b1af033ca2347f9fcc9daab
Submitter: Jenkins
Branch: master

commit 4a0ac4583b5e896d5b1af033ca2347f9fcc9daab
Author: Matt Mulsow <email address hidden>
Date: Mon Aug 8 21:26:01 2016 -0500

    User-agent header shouldn't start with a space

    If the application name, sys.argv[0], is an empty string, like when
    called from the Ansible os_network module, then keystoneauth (with
    the new requests 2.11.0) will raise an exception saying:

    Invalid return character or leading space in header: User-Agent

    This comes from keystoneauth trying to prepend the empty module
    name to the default user agent, which leads to it sending a
    User-Agent header that starts with a blank space. This was fine
    until the new requests 2.11.0 was released which errors if header
    values start with a leading space.

    With this change, if sys.argv[0] is an empty string we'll just use
    the DEFAULT_USER_AGENT and not try to prepend a calling module.

    Closes-Bug: #1611426

    Change-Id: I56d3e352dce7628add0479b3333a880700844ebc
    Signed-off-by: Matt Mulsow <email address hidden>