在Windows 7上运行Chef-Test-Kitchen后面的代理

时间:2015-12-01 18:09:28

标签: powershell chef test-kitchen

我正试图在Windows 7机器上运行Test-Kitchen,使用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/

我错过了一些明显的东西吗?

1 个答案:

答案 0 :(得分:1)

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