Giter Club home page Giter Club logo

Comments (7)

djberg96 avatar djberg96 commented on July 21, 2024

We could set it globally use RestClient.proxy, but I worry that could cause problems with any other code using RestClient.

Setting it per-request will be problematic, as the shortcut methods, such as RestClient.get, don't allow for us to set that option. They will all have to be changed to RestClient::Request.execute, and take a hash option.

from azure-armrest.

djberg96 avatar djberg96 commented on July 21, 2024

This was added by #126 and #128

from azure-armrest.

ogaida avatar ogaida commented on July 21, 2024

It does not work for me. In manageIQ - configuration-Advanced i have set the right Proxy IP and port number for http_proxy for azure, when i use curl with the same proxy settings it works. I can not find any documentation about using a proxy within manageIQ.

from azure-armrest.

djberg96 avatar djberg96 commented on July 21, 2024

@ogaida I know there was an issue with the proxy settings in general recently, but it has since been fixed.

from azure-armrest.

ogaida avatar ogaida commented on July 21, 2024

@djberg96

my Proxy-Config

2018-04-24 09_48_23-manageiq_ configuration

Result in the miq-Gui

2018-04-24 09_44_45-manageiq_ cloud providers

Content from /var/log/manageiq/azure.log

RestClient.post "https://login.microsoftonline.com/***REPLACED-ID***/oauth2/token", "grant_type=client_credentials&client_id=***REPLACED-ID***&client_secret=***REPLACED-SECRET***&resource=https%3A%2F%2Fmanagement.azure.com%2F", "Accept"=>"*/*", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"188", "Content-Type"=>"application/x-www-form-urlencoded", "User-Agent"=>"rest-client/2.0.2 (linux-gnu x86_64) ruby/2.3.1p112"

Stack-trace from /var/log/manageiq/evm.log

[----] E, [2018-04-24T08:40:06.617482 #1782:46f140] ERROR -- : MIQ(ManageIQ::Providers::Azure::CloudManager.connection_rescue_block) Error Class=SocketError, Message=Failed to open TCP connection to login.microsoftonline.com:443 (getaddrinfo: Name or service not known), Backtrace=["/usr/local/lib/ruby/2.3.0/net/http.rb:882:in `rescue in block in connect'", "/usr/local/lib/ruby/2.3.0/net/http.rb:879:in `block in connect'", "/usr/local/lib/ruby/2.3.0/timeout.rb:91:in `block in timeout'", "/usr/local/lib/ruby/2.3.0/timeout.rb:101:in `timeout'", "/usr/local/lib/ruby/2.3.0/net/http.rb:878:in `connect'", "/usr/local/lib/ruby/2.3.0/net/http.rb:863:in `do_start'", "/usr/local/lib/ruby/2.3.0/net/http.rb:852:in `start'", "/usr/local/lib/ruby/gems/2.3.0/gems/rest-client-2.0.2/lib/restclient/request.rb:715:in `transmit'", "/usr/local/lib/ruby/gems/2.3.0/gems/rest-client-2.0.2/lib/restclient/request.rb:145:in `execute'", "/usr/local/lib/ruby/gems/2.3.0/gems/rest-client-2.0.2/lib/restclient/request.rb:52:in `execute'", "/usr/local/lib/ruby/gems/2.3.0/gems/azure-armrest-0.9.7/lib/azure/armrest/armrest_service.rb:212:in `rest_execute'", "/usr/local/lib/ruby/gems/2.3.0/gems/azure-armrest-0.9.7/lib/azure/armrest/armrest_service.rb:235:in `rest_post'", "/usr/local/lib/ruby/gems/2.3.0/gems/azure-armrest-0.9.7/lib/azure/armrest/configuration.rb:292:in `fetch_token'", "/usr/local/lib/ruby/gems/2.3.0/gems/azure-armrest-0.9.7/lib/azure/armrest/configuration.rb:246:in `ensure_token'", "/usr/local/lib/ruby/gems/2.3.0/gems/azure-armrest-0.9.7/lib/azure/armrest/configuration.rb:170:in `token'", "/usr/local/lib/ruby/gems/2.3.0/gems/azure-armrest-0.9.7/lib/azure/armrest/armrest_service.rb:294:in `rest_execute'", "/usr/local/lib/ruby/gems/2.3.0/gems/azure-armrest-0.9.7/lib/azure/armrest/armrest_service.rb:304:in `rest_get'", "/usr/local/lib/ruby/gems/2.3.0/gems/azure-armrest-0.9.7/lib/azure/armrest/subscription_service.rb:16:in `list'", "/usr/local/lib/ruby/gems/2.3.0/gems/azure-armrest-0.9.7/lib/azure/armrest/configuration.rb:217:in `subscriptions'", "/usr/local/lib/ruby/gems/2.3.0/gems/azure-armrest-0.9.7/lib/azure/armrest/configuration.rb:233:in `validate_subscription'", "/usr/local/lib/ruby/gems/2.3.0/gems/azure-armrest-0.9.7/lib/azure/armrest/configuration.rb:154:in `subscription_id='", "/usr/local/lib/ruby/gems/2.3.0/gems/azure-armrest-0.9.7/lib/azure/armrest/configuration.rb:129:in `block in initialize'", "/usr/local/lib/ruby/gems/2.3.0/gems/azure-armrest-0.9.7/lib/azure/armrest/configuration.rb:129:in `each'", "/usr/local/lib/ruby/gems/2.3.0/gems/azure-armrest-0.9.7/lib/azure/armrest/configuration.rb:129:in `initialize'", "/usr/local/lib/ruby/gems/2.3.0/bundler/gems/manageiq-providers-azure-2401dcc2252d/app/models/manageiq/providers/azure/manager_mixin.rb:32:in `new'", "/usr/local/lib/ruby/gems/2.3.0/bundler/gems/manageiq-providers-azure-2401dcc2252d/app/models/manageiq/providers/azure/manager_mixin.rb:32:in `block in raw_connect'", "/usr/local/lib/ruby/gems/2.3.0/bundler/gems/manageiq-providers-azure-2401dcc2252d/app/models/manageiq/providers/azure/manager_mixin.rb:45:in `connection_rescue_block'", "/usr/local/lib/ruby/gems/2.3.0/bundler/gems/manageiq-providers-azure-2401dcc2252d/app/models/manageiq/providers/azure/manager_mixin.rb:31:in `raw_connect'", "/var/www/miq/vmdb/app/models/ext_management_system.rb:226:in `raw_connect?'", "/var/www/miq/vmdb/app/models/miq_queue.rb:449:in `block in dispatch_method'", "/usr/local/lib/ruby/2.3.0/timeout.rb:91:in `block in timeout'", "/usr/local/lib/ruby/2.3.0/timeout.rb:33:in `block in catch'", "/usr/local/lib/ruby/2.3.0/timeout.rb:33:in `catch'", "/usr/local/lib/ruby/2.3.0/timeout.rb:33:in `catch'", "/usr/local/lib/ruby/2.3.0/timeout.rb:106:in `timeout'", "/var/www/miq/vmdb/app/models/miq_queue.rb:448:in `dispatch_method'", "/var/www/miq/vmdb/app/models/miq_queue.rb:425:in `block in deliver'", "/var/www/miq/vmdb/app/models/user.rb:261:in `with_user_group'", "/var/www/miq/vmdb/app/models/miq_queue.rb:425:in `deliver'", "/var/www/miq/vmdb/app/models/miq_queue_worker_base/runner.rb:104:in `deliver_queue_message'", "/var/www/miq/vmdb/app/models/miq_queue_worker_base/runner.rb:134:in `deliver_message'", "/var/www/miq/vmdb/app/models/miq_queue_worker_base/runner.rb:152:in `block in do_work'", "/var/www/miq/vmdb/app/models/miq_queue_worker_base/runner.rb:146:in `loop'", "/var/www/miq/vmdb/app/models/miq_queue_worker_base/runner.rb:146:in `do_work'", "/var/www/miq/vmdb/app/models/miq_worker/runner.rb:329:in `block in do_work_loop'", "/var/www/miq/vmdb/app/models/miq_worker/runner.rb:326:in `loop'", "/var/www/miq/vmdb/app/models/miq_worker/runner.rb:326:in `do_work_loop'", "/var/www/miq/vmdb/app/models/miq_worker/runner.rb:153:in `run'", "/var/www/miq/vmdb/app/models/miq_worker/runner.rb:127:in `start'", "/var/www/miq/vmdb/app/models/miq_worker/runner.rb:22:in `start_worker'", "/var/www/miq/vmdb/app/models/miq_worker.rb:375:in `block in start_runner_via_fork'", "/usr/local/lib/ruby/gems/2.3.0/gems/nakayoshi_fork-0.0.3/lib/nakayoshi_fork.rb:24:in `fork'", "/usr/local/lib/ruby/gems/2.3.0/gems/nakayoshi_fork-0.0.3/lib/nakayoshi_fork.rb:24:in `fork'", "/var/www/miq/vmdb/app/models/miq_worker.rb:373:in `start_runner_via_fork'", "/var/www/miq/vmdb/app/models/miq_worker.rb:367:in `start_runner'", "/var/www/miq/vmdb/app/models/miq_worker.rb:414:in `start'", "/var/www/miq/vmdb/app/models/miq_worker.rb:266:in `start_worker'", "/var/www/miq/vmdb/app/models/miq_worker.rb:153:in `block in sync_workers'", "/var/www/miq/vmdb/app/models/miq_worker.rb:153:in `times'", "/var/www/miq/vmdb/app/models/miq_worker.rb:153:in `sync_workers'", "/var/www/miq/vmdb/app/models/miq_server/worker_management/monitor.rb:53:in `block in sync_workers'", "/var/www/miq/vmdb/app/models/miq_server/worker_management/monitor.rb:50:in `each'", "/var/www/miq/vmdb/app/models/miq_server/worker_management/monitor.rb:50:in `sync_workers'", "/var/www/miq/vmdb/app/models/miq_server.rb:141:in `start'", "/var/www/miq/vmdb/app/models/miq_server.rb:233:in `start'", "/var/www/miq/vmdb/lib/workers/evm_server.rb:27:in `start'", "/var/www/miq/vmdb/lib/workers/evm_server.rb:48:in `start'", "/var/www/miq/vmdb/lib/workers/bin/evm_server.rb:4:in `<main>'"]

RestClient-Test in irb without a Proxy

it starts with the same stacktrace

# irb
irb(main):001:0> require "rest-client"
=> true
irb(main):002:0> RestClient.post "https://login.microsoftonline.com/***REPLACED-ID***/oauth2/token", "grant_type=client_credentials&client_id=***REPLACED-ID***&client_secret=***REPLACED-SECRET***&resource=https%3A%2F%2Fmanagement.azure.com%2F", "Accept"=>"*/*", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"188", "Content-Type"=>"application/x-www-form-urlencoded", "User-Agent"=>"rest-client/2.0.2 (linux-gnu x86_64) ruby/2.3.1p112"
SocketError: Failed to open TCP connection to login.microsoftonline.com:443 (getaddrinfo: Name or service not known)
        from /usr/local/lib/ruby/2.3.0/net/http.rb:882:in `rescue in block in connect'
        from /usr/local/lib/ruby/2.3.0/net/http.rb:879:in `block in connect'
        from /usr/local/lib/ruby/2.3.0/timeout.rb:91:in `block in timeout'
        from /usr/local/lib/ruby/2.3.0/timeout.rb:101:in `timeout'
        from /usr/local/lib/ruby/2.3.0/net/http.rb:878:in `connect'
        from /usr/local/lib/ruby/2.3.0/net/http.rb:863:in `do_start'
        from /usr/local/lib/ruby/2.3.0/net/http.rb:852:in `start'
        from /usr/local/lib/ruby/gems/2.3.0/gems/rest-client-2.0.2/lib/restclient/request.rb:715:in `transmit'
        from /usr/local/lib/ruby/gems/2.3.0/gems/rest-client-2.0.2/lib/restclient/request.rb:145:in `execute'
        from /usr/local/lib/ruby/gems/2.3.0/gems/rest-client-2.0.2/lib/restclient/request.rb:52:in `execute'
        from /usr/local/lib/ruby/gems/2.3.0/gems/rest-client-2.0.2/lib/restclient.rb:71:in `post'
        from (irb):2
        from /usr/local/bin/irb:11:in `<main>'

RestClient-Test in irb with Proxy

it works

# irb
irb(main):001:0>  require "rest-client"
=> true
irb(main):002:0> RestClient.proxy = "http://19***replaced***:8080"
=> "http://19***replaced***:8080"
irb(main):003:0> RestClient.post "https://login.microsoftonline.com/***REPLACED-ID***/oauth2/token", "grant_type=client_credentials&client_id=***REPLACED-ID***&client_secret=***REPLACED-SECRET***&resource=https%3A%2F%2Fmanagement.azure.com%2F", "Accept"=>"*/*", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"188", "Content-Type"=>"application/x-www-form-urlencoded", "User-Agent"=>"rest-client/2.0.2 (linux-gnu x86_64) ruby/2.3.1p112"
=> <RestClient::Response 200 "{\"token_typ...">

Could you please reopen this issue.

from azure-armrest.

djberg96 avatar djberg96 commented on July 21, 2024

@ogaida Since this issue isn't specific to the azure-armrest gem, can you please create a new issue at the azure provider repo?

https://github.com/ManageIQ/manageiq-providers-azure

from azure-armrest.

ogaida avatar ogaida commented on July 21, 2024

@djberg96 Thank you the hint. I opened an issue there ManageIQ/manageiq-providers-azure#247

from azure-armrest.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.