vmware-archive / rvc

RVC is a Linux console UI for vSphere, built on the RbVmomi bindings to the vSphere API.
MIT License
240 stars 48 forks source link

No consistent proxy usage? #96

Open f0o opened 9 years ago

f0o commented 9 years ago

Hi,

I got http_proxy,https_proxy,HTTP_PROXY and HTTPS_PROXY environment variables set but I'm unable to connect to my vsphere using rvc vsphere.example.net.

Any ideas?

OS: CentOS 7, 64bit Installed via gem install rvc

Log:

/usr/share/ruby/net/http.rb:878:in `initialize': Network is unreachable - connect(2) (Errno::ENETUNREACH)
        from /usr/share/ruby/net/http.rb:878:in `open'
        from /usr/share/ruby/net/http.rb:878:in `block in connect'
        from /usr/share/ruby/timeout.rb:66:in `timeout'
        from /usr/share/ruby/net/http.rb:877:in `connect'
        from /usr/share/ruby/net/http.rb:862:in `do_start'
        from /usr/share/ruby/net/http.rb:857:in `start'
        from /usr/local/share/gems/gems/rbvmomi-1.8.2/lib/rbvmomi/trivial_soap.rb:56:in `restart_http'
        from /usr/local/share/gems/gems/rbvmomi-1.8.2/lib/rbvmomi/trivial_soap.rb:20:in `initialize'
        from /usr/local/share/gems/gems/rbvmomi-1.8.2/lib/rbvmomi/connection.rb:31:in `initialize'
        from /usr/local/share/gems/gems/rvc-1.8.0/lib/rvc/modules/vsan.rb:2440:in `initialize'
        from /usr/local/share/gems/gems/rvc-1.8.0/lib/rvc/modules/vim.rb:47:in `new'
        from /usr/local/share/gems/gems/rvc-1.8.0/lib/rvc/modules/vim.rb:47:in `block in connect'
        from /usr/local/share/gems/gems/rvc-1.8.0/lib/rvc/modules/vim.rb:45:in `loop'
        from /usr/local/share/gems/gems/rvc-1.8.0/lib/rvc/modules/vim.rb:45:in `connect'
        from /usr/local/share/gems/gems/rvc-1.8.0/lib/rvc/modules/vim.rb:24:in `block in load_code'
        from /usr/local/share/gems/gems/rvc-1.8.0/bin/rvc:83:in `[]'
        from /usr/local/share/gems/gems/rvc-1.8.0/bin/rvc:83:in `block in <top (required)>'
        from /usr/local/share/gems/gems/rvc-1.8.0/bin/rvc:71:in `each'
        from /usr/local/share/gems/gems/rvc-1.8.0/bin/rvc:71:in `<top (required)>'
        from /usr/local/bin/rvc:23:in `load'
        from /usr/local/bin/rvc:23:in `<main>'
dedwards-tech commented 9 years ago

It could be a dns issue rather than proxy issue?

Also, did you make sure to set the proper port number: myproxy.mynet.com:####

From: Daniel Preussker [mailto:notifications@github.com] Sent: Wednesday, February 25, 2015 4:24 AM To: vmware/rvc Subject: [rvc] No consistent proxy usage? (#96)

Hi,

I got http_proxy,https_proxy,HTTP_PROXY and HTTPS_PROXY environment variables set but I'm unable to connect to my vsphere using rvc vsphere.example.net.

Any ideas?

Log:

/usr/share/ruby/net/http.rb:878:in `initialize': Network is unreachable - connect(2) (Errno::ENETUNREACH)

    from /usr/share/ruby/net/http.rb:878:in `open'

    from /usr/share/ruby/net/http.rb:878:in `block in connect'

    from /usr/share/ruby/timeout.rb:66:in `timeout'

    from /usr/share/ruby/net/http.rb:877:in `connect'

    from /usr/share/ruby/net/http.rb:862:in `do_start'

    from /usr/share/ruby/net/http.rb:857:in `start'

    from /usr/local/share/gems/gems/rbvmomi-1.8.2/lib/rbvmomi/trivial_soap.rb:56:in `restart_http'

    from /usr/local/share/gems/gems/rbvmomi-1.8.2/lib/rbvmomi/trivial_soap.rb:20:in `initialize'

    from /usr/local/share/gems/gems/rbvmomi-1.8.2/lib/rbvmomi/connection.rb:31:in `initialize'

    from /usr/local/share/gems/gems/rvc-1.8.0/lib/rvc/modules/vsan.rb:2440:in `initialize'

    from /usr/local/share/gems/gems/rvc-1.8.0/lib/rvc/modules/vim.rb:47:in `new'

    from /usr/local/share/gems/gems/rvc-1.8.0/lib/rvc/modules/vim.rb:47:in `block in connect'

    from /usr/local/share/gems/gems/rvc-1.8.0/lib/rvc/modules/vim.rb:45:in `loop'

    from /usr/local/share/gems/gems/rvc-1.8.0/lib/rvc/modules/vim.rb:45:in `connect'

    from /usr/local/share/gems/gems/rvc-1.8.0/lib/rvc/modules/vim.rb:24:in `block in load_code'

    from /usr/local/share/gems/gems/rvc-1.8.0/bin/rvc:83:in `[]'

    from /usr/local/share/gems/gems/rvc-1.8.0/bin/rvc:83:in `block in <top (required)>'

    from /usr/local/share/gems/gems/rvc-1.8.0/bin/rvc:71:in `each'

    from /usr/local/share/gems/gems/rvc-1.8.0/bin/rvc:71:in `<top (required)>'

    from /usr/local/bin/rvc:23:in `load'

    from /usr/local/bin/rvc:23:in `<main>'

— Reply to this email directly or view it on GitHubhttps://github.com/vmware/rvc/issues/96.

f0o commented 9 years ago

Hi dedwards,

Proxy has been specified with IP:PORT :/

DNS resolves fine for the vsphere-domain too

On 2015-02-25 18:48, dedwards wrote:

It could be a dns issue rather than proxy issue?

Also, did you make sure to set the proper port number:
myproxy.mynet.com:####

From: Daniel Preussker [mailto:notifications@github.com] Sent: Wednesday, February 25, 2015 4:24 AM To: vmware/rvc Subject: [rvc] No consistent proxy usage? (#96)

Hi,

I got http_proxy,https_proxy,HTTP_PROXY and HTTPS_PROXY environment variables set but I'm unable to connect to my vsphere using rvc vsphere.example.net.

Any ideas?

Log:

/usr/share/ruby/net/http.rb:878:in `initialize': Network is unreachable - connect(2) (Errno::ENETUNREACH)

    from /usr/share/ruby/net/http.rb:878:in `open'

    from /usr/share/ruby/net/http.rb:878:in `block in connect'

    from /usr/share/ruby/timeout.rb:66:in `timeout'

    from /usr/share/ruby/net/http.rb:877:in `connect'

    from /usr/share/ruby/net/http.rb:862:in `do_start'

    from /usr/share/ruby/net/http.rb:857:in `start'

    from

/usr/local/share/gems/gems/rbvmomi-1.8.2/lib/rbvmomi/trivial_soap.rb:56:in `restart_http'

    from

/usr/local/share/gems/gems/rbvmomi-1.8.2/lib/rbvmomi/trivial_soap.rb:20:in `initialize'

    from

/usr/local/share/gems/gems/rbvmomi-1.8.2/lib/rbvmomi/connection.rb:31:in `initialize'

    from

/usr/local/share/gems/gems/rvc-1.8.0/lib/rvc/modules/vsan.rb:2440:in `initialize'

    from

/usr/local/share/gems/gems/rvc-1.8.0/lib/rvc/modules/vim.rb:47:in `new'

    from

/usr/local/share/gems/gems/rvc-1.8.0/lib/rvc/modules/vim.rb:47:in `block in connect'

    from

/usr/local/share/gems/gems/rvc-1.8.0/lib/rvc/modules/vim.rb:45:in `loop'

    from

/usr/local/share/gems/gems/rvc-1.8.0/lib/rvc/modules/vim.rb:45:in `connect'

    from

/usr/local/share/gems/gems/rvc-1.8.0/lib/rvc/modules/vim.rb:24:in `block in load_code'

    from /usr/local/share/gems/gems/rvc-1.8.0/bin/rvc:83:in `[]'

    from /usr/local/share/gems/gems/rvc-1.8.0/bin/rvc:83:in `block

in <top (required)>'

    from /usr/local/share/gems/gems/rvc-1.8.0/bin/rvc:71:in `each'

    from /usr/local/share/gems/gems/rvc-1.8.0/bin/rvc:71:in `<top

(required)>'

    from /usr/local/bin/rvc:23:in `load'

    from /usr/local/bin/rvc:23:in `<main>'

— Reply to this email directly or view it on GitHubhttps://github.com/vmware/rvc/issues/96.


Reply to this email directly or view it on GitHub: https://github.com/vmware/rvc/issues/96#issuecomment-76028579

jessehu commented 9 years ago

Seems https://github.com/vmware/rbvmomi/blob/master/lib/rbvmomi/trivial_soap.rb#L38 needs the caller to set "@opts[:proxyHost], @opts[:proxyPort]". You can try modifying the file vim.rb like this:

vi gem env gemdir/gems/rvc-1.8.0/lib/rvc/modules/vim.rb

  if ENV[:http_proxy]
    http, proxyHost, proxyPort = ENV[:http_proxy].split(':')
    proxyHost = proxyHost[2..-1]
  else
    proxyHost = nil
    proxyPort = nil
  end
  vim = RbVmomi::VIM.new :host => host,
                         :port => port,
                         :path => '/sdk',
                         :ns => 'urn:vim25',
                         :rev => (opts[:rev]||'4.0'),
                         :ssl => true,
                         :insecure => bad_cert, :proxyHost => proxyHost, :proxyPort => proxyPort

I don't have an proxy env in hand, so can not test the code now.