NO_PROXY environment variable is not considered while installing the pack dependencies
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 6.5k
- Forks
- 787
- PR merge metrics
- No merged PRs in 30d
Description
SUMMARY
I have HTTP_PROXY, HTTPS_PROXY and NO_PROXY environment variables set in my setup and also, I maintain an internal PyPI hosting most of the python dependencies. Now, I want the st2 pack install file:///path/to/pack/folder command to download python dependencies from this internal PyPI instead of the official PyPI and so, I added the internal PyPI URL to the NO_PROXY environment variable. But the st2 pack install always tries to fetch the dependencies via the HTTP(S)_PROXY only.
STACKSTORM VERSION
st2 3.1.0, on Python 3.6.9
Steps to reproduce the problem
Set HTTP_PROXY and HTTPS_PROXY environment variables and make sure NO_PROXY environment variable contain the internal PyPI URL. Now, install a pack using st2 pack install and it will still try to fetch the dependencies via the proxy instead of avoiding it.
Expected Results
Ideally during the pack installation, the dependencies should be pulled directly from the internal PyPI avoiding the HTTP(S)_PROXY as the internal PyPI URL is part of the NO_PROXY environment variable.
Actual Results
Downloads the dependencies using the HTTP(S)_PROXY or FAILS if the HTTP(s)_PROXY URL is not reachable.
What happened? What output did you get?
I made the proxies set via HTTP(s)_PROXY unreachable, and ran st2 pack install file:///path/to/pack/folder failed while installing the dependencies.
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Forbidden',))': /internal/blobs/six/
Ideally it should never check for the HTTP(S)_PROXY and pull the dependencies from the internal PyPI.
Possible bug:
I see that we always set --proxy flag on the pip install command if the HTTP(S)_PROXY env. variable is set or the http_proxy or https_proxy are set in the config file as described here: https://docs.stackstorm.com/packs.html#installing-packs-from-behind-a-proxy and NO_PROXY is not checked.
https://github.com/StackStorm/st2/blob/master/st2common/st2common/util/virtualenvs.py#L244
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at st2common/st2common/util/virtualenvs.py#L244 and trace how st2 pack install builds its pip install command. Reproduce the behavior with HTTP_PROXY, HTTPS_PROXY, and NO_PROXY set; done means dependencies from the internal PyPI URL bypass the proxies during pack installation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100