运行 Windows 7 上 Proxy 后面的 Chef Test-Kitchen

Running Chef Test-Kitchen behind Proxy on Windows 7

我正在尝试 运行 Test-Kitchen 在 Windows 7 box 上,使用 Powershell,在企业防火墙后面(我正在学习 http://kitchen.ci/docs/getting-started/creating-cookbook 上的教程)。当我 运行:

PS C:\Users\jazzyb\Documents\git-cookbook> kitchen init --driver=kitchen-vagrant

我明白了

   identical  .kitchen.yml
   identical  chefignore
ERROR:  Could not find a valid gem 'kitchen-vagrant' (>= 0), here is why:
          Unable to download data from https://rubygems.org/ - Errno::ECONNREFUSED: No connection could be made because
the target machine actively refused it. - connect(2) for "api.rubygems.org" port 443 (https://api.rubygems.org/specs.4.8
.gz)
PS C:\Users\jazzyb\Documents\git-cookbook>

尽管我可以使用 Invoke-WebRequest 访问该文件

PS C:\Users\jazzyb\Documents\git-cookbook> Invoke-WebRequest https://api.rubygems.org/specs.4.8.gz


StatusCode        : 200
StatusDescription : OK
Content           : {31, 139, 8, 0...}
RawContent        : HTTP/1.1 200 OK
                    x-amz-id-2: aVuWL3xWz9vwwto0GZE0uAJ4q8o8N+QsIC9QUJmO63mVNxY95pv994RHuQFrdaCCtvADJSaOOfo=
                    x-amz-request-id: CC71B064EACA4126
                    x-amz-version-id: 4Q20EeykLoACN7Ko3b9Bqw1cARiGEbaI
                    x-amz...
Headers           : {[x-amz-id-2, aVuWL3xWz9vwwto0GZE0uAJ4q8o8N+QsIC9QUJmO63mVNxY95pv994RHuQFrdaCCtvADJSaOOfo=],
                    [x-amz-request-id, CC71B064EACA4126], [x-amz-version-id, 4Q20EeykLoACN7Ko3b9Bqw1cARiGEbaI],
                    [x-amz-meta-surrogate-key, full-index]...}
RawContentLength  : 2626893

直接设置代理好像也不行

PS C:\Users\jazzyb\Documents\git-cookbook> kitchen init --driver=kitchen-vagrant --http_proxy=http://proxy.somecorp.com:80/

我是不是遗漏了什么明显的东西?

导出 http_proxyHTTP_PROXYhttps_proxyHTTPS_PROXY 环境变量。 Rubygems 不直接支持 Windows' 代理配置系统,您需要以 Unix 方式进行。