Pulp upgrade fails with pip._vendor.requests.exceptions.InvalidURL: Failed to parse: http

Problem:
I try to upgrade pulp but it fails with the following error:

" File “/usr/local/lib/pulp/lib64/python3.8/site-packages/pip/_vendor/cachecontrol/adapter.py”, line 57, in send",
" resp = super(CacheControlAdapter, self).send(request, **kw)",
" File “/usr/local/lib/pulp/lib64/python3.8/site-packages/pip/_vendor/requests/adapters.py”, line 415, in send",
" raise InvalidURL(e, request=request)",
pip._vendor.requests.exceptions.InvalidURL: Failed to parse: http://user:pw@url:port

I guess the problem is due to special characters in the password which cause trouble to python module

My playbook looks like this:

- hosts: all
  force_handlers: True
  vars:
    pulp_default_admin_password: <password>
    pulp_settings:
      secret_key: <secret>
      content_origin: "https://{{ ansible_fqdn }}"
    pulpcore_update: true
    pulp_install_plugins:
      pulp-file:
        upgrade: true
      pulp-rpm:
        upgrade: true
      pulp-ansible:
        upgrade: true
    pulp_repos_enable: False
  roles:
    - pulp.pulp_installer.pulp_all_services
  environment:
    DJANGO_SETTINGS_MODULE: pulpcore.app.settings
    http_proxy: http://<user>:<password>@<url>:<port>
    https_proxy: http://<user>:<password>@<url>:<port>
    no_proxy: 127.0.0.1
    ANSIBLE_REMOTE_TMP: /var/tmp/ansible

Any ideas how to escape special chars here? Or is there another workaround possible?

Expected outcome:
No issue with upgrade

Pulpcore version:

“versions”: [
{
“component”: “core”,
“version”: “3.21.3”,
“package”: “pulpcore”
},

Pulp plugins installed and their versions:

“versions”: [

{
  "component": "rpm",
  "version": "3.18.9",
  "package": "pulp-rpm"
},
{
  "component": "file",
  "version": "1.11.2",
  "package": "pulp-file"
},
{
  "component": "ansible",
  "version": "0.16.0",
  "package": "pulp-ansible"
}

],

Operating system - distribution and version:
RHEL 7.9

Other relevant data:

I’ve managed to figure this out. This helped:

I’ve set the variable with the password:
vars:
proxy_pass: mypassword

and then in environment I’ve set:

http_proxy: http://user:{{ proxy_pass | urlencode}}@url:port

1 Like