Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mirror with configuration files does not support quoting, or credentials #321

Open
Mythra opened this issue Jan 9, 2023 · 0 comments · May be fixed by #322
Open

Mirror with configuration files does not support quoting, or credentials #321

Mythra opened this issue Jan 9, 2023 · 0 comments · May be fixed by #322

Comments

@Mythra
Copy link

Mythra commented Jan 9, 2023

Hi,

I was attempting to setup this project in an environment where we want to fetch the nodejs dependencies from Artifactory our own internal mirror as egress is locked down. Unfortunately, we are not able to use the configuration file as is mentioned in the README.

When configuring the URL as mentioned in the readme with quotes:

[nodeenv]
mirror = 'https://user:pass@artifactory.instance/artifactory/generic-nodejs-mirror'
You get this lovely error, as the quotes aren't stripped
$ poetry run pyright
Traceback (most recent call last):
File "C:\Users\ccoan\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
  return _run_code(code, main_globals, None,
File "C:\Users\ccoan\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
  exec(code, run_globals)
File "C:\Users\ccoan\AppData\Local\pypoetry\Cache\virtualenvs\<project-name>-LETqD2Zl-py3.10\lib\site-packages\nodeenv.py", line 1519, in <module>
  main()
File "C:\Users\ccoan\AppData\Local\pypoetry\Cache\virtualenvs\<project-name>-LETqD2Zl-py3.10\lib\site-packages\nodeenv.py", line 1093, in main
  args.node = get_last_stable_node_version()
File "C:\Users\ccoan\AppData\Local\pypoetry\Cache\virtualenvs\<project-name>-LETqD2Zl-py3.10\lib\site-packages\nodeenv.py", line 1026, in get_last_stable_node_version
  return _get_versions_json()[0]['version'].lstrip('v')
File "C:\Users\ccoan\AppData\Local\pypoetry\Cache\virtualenvs\<project-name>-LETqD2Zl-py3.10\lib\site-packages\nodeenv.py", line 1002, in _get_versions_json
  response = urlopen('%s/index.json' % src_base_url)
File "C:\Users\ccoan\AppData\Local\pypoetry\Cache\virtualenvs\<project-name>-LETqD2Zl-py3.10\lib\site-packages\nodeenv.py", line 624, in urlopen
  return urllib2.urlopen(req)
File "C:\Users\ccoan\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 216, in urlopen
  return opener.open(url, data, timeout)
File "C:\Users\ccoan\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 519, in open
  response = self._open(req, data)
File "C:\Users\ccoan\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 541, in _open
  return self._call_chain(self.handle_open, 'unknown',
File "C:\Users\ccoan\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 496, in _call_chain
  result = func(*args)
File "C:\Users\ccoan\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 1419, in unknown_open
  raise URLError('unknown url type: %s' % type)
urllib.error.URLError: <urlopen error unknown url type: 'https>
Traceback (most recent call last):
File "C:\Users\ccoan\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
  return _run_code(code, main_globals, None,
File "C:\Users\ccoan\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
  exec(code, run_globals)
File "C:\Users\ccoan\AppData\Local\pypoetry\Cache\virtualenvs\<project-name>-LETqD2Zl-py3.10\Scripts\pyright.exe\__main__.py", line 7, in <module>
File "C:\Users\ccoan\AppData\Local\pypoetry\Cache\virtualenvs\<project-name>-LETqD2Zl-py3.10\lib\site-packages\pyright\cli.py", line 81, in entrypoint
  sys.exit(main(sys.argv[1:]))
File "C:\Users\ccoan\AppData\Local\pypoetry\Cache\virtualenvs\<project-name>-LETqD2Zl-py3.10\lib\site-packages\pyright\cli.py", line 21, in main
  return run(*args, **kwargs).returncode
File "C:\Users\ccoan\AppData\Local\pypoetry\Cache\virtualenvs\<project-name>-LETqD2Zl-py3.10\lib\site-packages\pyright\cli.py", line 38, in run
  npx = node.version('npx')
File "C:\Users\ccoan\AppData\Local\pypoetry\Cache\virtualenvs\<project-name>-LETqD2Zl-py3.10\lib\site-packages\pyright\node.py", line 118, in version
  proc = run(target, '--version', stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
File "C:\Users\ccoan\AppData\Local\pypoetry\Cache\virtualenvs\<project-name>-LETqD2Zl-py3.10\lib\site-packages\pyright\node.py", line 97, in run
  binary = _ensure_available(target)
File "C:\Users\ccoan\AppData\Local\pypoetry\Cache\virtualenvs\<project-name>-LETqD2Zl-py3.10\lib\site-packages\pyright\node.py", line 36, in _ensure_available
  return Binary(path=_ensure_node_env(target), strategy=Strategy.NODEENV)
File "C:\Users\ccoan\AppData\Local\pypoetry\Cache\virtualenvs\<project-name>-LETqD2Zl-py3.10\lib\site-packages\pyright\node.py", line 63, in _ensure_node_env
  _install_node_env()
File "C:\Users\ccoan\AppData\Local\pypoetry\Cache\virtualenvs\<project-name>-LETqD2Zl-py3.10\lib\site-packages\pyright\node.py", line 90, in _install_node_env
  subprocess.run(args, check=True)
File "C:\Users\ccoan\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 524, in run
  raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['C:\\Users\\ccoan\\AppData\\Local\\pypoetry\\Cache\\virtualenvs\\<project-name>-LETqD2Zl-py3.10\\Scripts\\python.exe', '-m', 'nodeenv', 'C:\\Users\\ccoan\\AppData\\Local\\Temp\\pyright-python.ccoan\\env']' returned non-zero exit status 1.

The key line being: urllib.error.URLError: <urlopen error unknown url type: 'https>

The same also happens with double quotes (although with a double quote in the error instead of a single quote). At first I thought okay we could just strip the quotes 'what could go wrong'. Unfortunately, the configuration parser than gets confused by the credentials:

[nodeenv]
mirror = https://user:pass@artifactory.instance/...
Produces this error
Traceback (most recent call last):
File "C:\Users\ccoan\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 889, in _get_hostport
  port = int(host[i+1:])
ValueError: invalid literal for int() with base 10: '<password>@artifactory.instance'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\ccoan\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
  return _run_code(code, main_globals, None,
File "C:\Users\ccoan\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
  exec(code, run_globals)
File "C:\Users\ccoan\AppData\Local\pypoetry\Cache\virtualenvs\<project-name>-LETqD2Zl-py3.10\lib\site-packages\nodeenv.py", line 1519, in <module>
  main()
File "C:\Users\ccoan\AppData\Local\pypoetry\Cache\virtualenvs\<project-name>-LETqD2Zl-py3.10\lib\site-packages\nodeenv.py", line 1093, in main
  args.node = get_last_stable_node_version()
File "C:\Users\ccoan\AppData\Local\pypoetry\Cache\virtualenvs\<project-name>-LETqD2Zl-py3.10\lib\site-packages\nodeenv.py", line 1026, in get_last_stable_node_version
  return _get_versions_json()[0]['version'].lstrip('v')
File "C:\Users\ccoan\AppData\Local\pypoetry\Cache\virtualenvs\<project-name>-LETqD2Zl-py3.10\lib\site-packages\nodeenv.py", line 1002, in _get_versions_json
  response = urlopen('%s/index.json' % src_base_url)
File "C:\Users\ccoan\AppData\Local\pypoetry\Cache\virtualenvs\<project-name>-LETqD2Zl-py3.10\lib\site-packages\nodeenv.py", line 624, in urlopen
  return urllib2.urlopen(req)
File "C:\Users\ccoan\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 216, in urlopen
  return opener.open(url, data, timeout)
File "C:\Users\ccoan\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 519, in open
  response = self._open(req, data)
File "C:\Users\ccoan\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 536, in _open
  result = self._call_chain(self.handle_open, protocol, protocol +
File "C:\Users\ccoan\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 496, in _call_chain
  result = func(*args)
File "C:\Users\ccoan\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 1391, in https_open
  return self.do_open(http.client.HTTPSConnection, req,
File "C:\Users\ccoan\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 1317, in do_open
  h = http_class(host, timeout=req.timeout, **http_conn_args)
File "C:\Users\ccoan\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 1409, in __init__
  super(HTTPSConnection, self).__init__(host, port, timeout,
File "C:\Users\ccoan\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 851, in __init__
  (self.host, self.port) = self._get_hostport(host, port)
File "C:\Users\ccoan\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 894, in _get_hostport
  raise InvalidURL("nonnumeric port: '%s'" % host[i+1:])
http.client.InvalidURL: nonnumeric port: '<password>@artifactory.instance'
Traceback (most recent call last):
File "C:\Users\ccoan\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
  return _run_code(code, main_globals, None,
File "C:\Users\ccoan\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
  exec(code, run_globals)
File "C:\Users\ccoan\AppData\Local\pypoetry\Cache\virtualenvs\<project-name>-LETqD2Zl-py3.10\Scripts\pyright.exe\__main__.py", line 7, in <module>
File "C:\Users\ccoan\AppData\Local\pypoetry\Cache\virtualenvs\<project-name>-LETqD2Zl-py3.10\lib\site-packages\pyright\cli.py", line 81, in entrypoint
  sys.exit(main(sys.argv[1:]))
File "C:\Users\ccoan\AppData\Local\pypoetry\Cache\virtualenvs\<project-name>-LETqD2Zl-py3.10\lib\site-packages\pyright\cli.py", line 21, in main
  return run(*args, **kwargs).returncode
File "C:\Users\ccoan\AppData\Local\pypoetry\Cache\virtualenvs\<project-name>-LETqD2Zl-py3.10\lib\site-packages\pyright\cli.py", line 38, in run
  npx = node.version('npx')
File "C:\Users\ccoan\AppData\Local\pypoetry\Cache\virtualenvs\<project-name>-LETqD2Zl-py3.10\lib\site-packages\pyright\node.py", line 118, in version
  proc = run(target, '--version', stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
File "C:\Users\ccoan\AppData\Local\pypoetry\Cache\virtualenvs\<project-name>-LETqD2Zl-py3.10\lib\site-packages\pyright\node.py", line 97, in run
  binary = _ensure_available(target)
File "C:\Users\ccoan\AppData\Local\pypoetry\Cache\virtualenvs\<project-name>-LETqD2Zl-py3.10\lib\site-packages\pyright\node.py", line 36, in _ensure_available
  return Binary(path=_ensure_node_env(target), strategy=Strategy.NODEENV)
File "C:\Users\ccoan\AppData\Local\pypoetry\Cache\virtualenvs\<project-name>-LETqD2Zl-py3.10\lib\site-packages\pyright\node.py", line 63, in _ensure_node_env
  _install_node_env()
File "C:\Users\ccoan\AppData\Local\pypoetry\Cache\virtualenvs\<project-name>-LETqD2Zl-py3.10\lib\site-packages\pyright\node.py", line 90, in _install_node_env
  subprocess.run(args, check=True)
File "C:\Users\ccoan\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 524, in run
  raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['C:\\Users\\ccoan\\AppData\\Local\\pypoetry\\Cache\\virtualenvs\\<project-name>-LETqD2Zl-py3.10\\Scripts\\python.exe', '-m', 'nodeenv', 'C:\\Users\\ccoan\\AppData\\Local\\Temp\\pyright-python.ccoan\\env']' returned non-zero exit status 1.

The key lines being: ValueError: invalid literal for int() with base 10: '<password>@artifactory.instance', and: raise InvalidURL("nonnumeric port: '%s'" % host[i+1:]).

@Mythra Mythra linked a pull request Jan 9, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant