2015-11-11 57 views
0

我目前正在遷移到Puppet 4.x.我使用Puppet 4.2.3和Puppetserver 2.1.2運行Ubuntu Server 14.04。我必須添加一些額外的寶石到服務器和一些代理。兩個命令都無限期地掛起。puppetserver gem install不尊重http代理

/opt/puppetlabs/bin/puppetserver gem install -V --no-rdoc --no-ri -p http://myproxy.com:8080 rest-client 
/opt/puppetlabs/puppet/bin/gem install -V --no-rdoc --no-ri -p http://myproxy.com:8080 rest-client 

當我省略代理設置時,我得到相同的行爲。

當我在安裝的Ruby 1.9.3環境下在同一臺機器上運行gem install命令時。一切工作完美,所以代理工作正常:

gem install -V --no-rdoc --no-ri rest-client -p http://myproxy.com:8080 
GET http://rubygems.org/latest_specs.4.8.gz 
302 Found 
GET http://rubygems.global.ssl.fastly.net/latest_specs.4.8.gz 
200 OK 
GET http://rubygems.org/quick/Marshal.4.8/rest-client-1.8.0.gemspec.rz 
302 Found 
GET http://rubygems.global.ssl.fastly.net/quick/Marshal.4.8/rest-client-1.8.0.gemspec.rz 
200 OK 
... 

有沒有人有一個想法如何解決這個問題。它成爲我現在的一個硬攔截器。

+0

你有沒有試過用'strace'看看'gem'進程,看看它卡在哪裏以及它想要做什麼? –

+0

看看我後來發佈的答案。您是否瞭解如何解決這個問題,而沒有這種黑客攻擊方法? –

+0

o_O您的機器是否缺乏熵?你可以嘗試安裝'havaged'或類似的工具。 –

回答

0

我已經找到了問題... jstack給了我下面的跟蹤:

"main" prio=10 tid=0x00007fce4400a000 nid=0x2f89 runnable [0x00007fce4d709000] 
    java.lang.Thread.State: RUNNABLE 
    at java.io.FileInputStream.readBytes(Native Method) 
    at java.io.FileInputStream.read(FileInputStream.java:272) 
    at sun.security.provider.SeedGenerator$URLSeedGenerator.getSeedBytes(SeedGenerator.java:551) 
    at sun.security.provider.SeedGenerator.generateSeed(SeedGenerator.java:139) 
    at sun.security.provider.SecureRandom$SeederHolder.<clinit>(SecureRandom.java:197) 
    at sun.security.provider.SecureRandom.engineNextBytes(SecureRandom.java:214) 
    - locked <0x00000000c34ba1e8> (a sun.security.provider.SecureRandom) 
    at java.security.SecureRandom.nextBytes(SecureRandom.java:466) 
    - locked <0x00000000c34ba190> (a java.security.SecureRandom) 
    at org.jruby.ext.securerandom.SecureRandomLibrary.nextBytes(SecureRandomLibrary.java:49) 
    at org.jruby.ext.securerandom.SecureRandomLibrary.nextBytes(SecureRandomLibrary.java:42) 
    at org.jruby.ext.securerandom.SecureRandomLibrary.random_bytes(SecureRandomLibrary.java:21) 
    at org.jruby.ext.securerandom.SecureRandomLibrary$INVOKER$s$random_bytes.call(SecureRandomLibrary$INVOKER$s$random_bytes.gen) 

這個問題可以通過固定加入-Djava.security.egd=file:/dev/./urandom/opt/puppetlabs/server/apps/puppetserver/cli/apps/gem

更新

一個更好的解決辦法是安裝另一個工具,如havaged補救辦法低熵狀態。一個Puppet模塊可以在這裏找到:https://forge.puppetlabs.com/stm/haveged