Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle vmpooler URL key that doesn't have 'https' #27

Closed
briancain opened this issue Aug 25, 2016 · 0 comments
Closed

Handle vmpooler URL key that doesn't have 'https' #27

briancain opened this issue Aug 25, 2016 · 0 comments

Comments

@briancain
Copy link
Contributor

If a user doesn't include 'https' in their URL setting, Faraday can't properly make a request with that URL. Since it doesn't seem like Faraday has an option to just use a URI, vmfloaty should handle that case so users aren't presented with a fun stacktrace if they forget 'https'.

brian@localhorse:~ % floaty list --url vcloud.delivery.puppetlabs.net/api/v1 --trace
/Users/brian/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/uri/generic.rb:1203:in `rescue in merge': both URI are relative (URI::BadURIError)
        from /Users/brian/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/uri/generic.rb:1200:in `merge'
        from /Users/brian/.rvm/gems/ruby-2.0.0-p481/gems/faraday-0.9.1/lib/faraday/connection.rb:406:in `build_exclusive_url'
        from /Users/brian/.rvm/gems/ruby-2.0.0-p481/gems/faraday-0.9.1/lib/faraday/rack_builder.rb:191:in `build_env'
        from /Users/brian/.rvm/gems/ruby-2.0.0-p481/gems/faraday-0.9.1/lib/faraday/rack_builder.rb:139:in `build_response'
        from /Users/brian/.rvm/gems/ruby-2.0.0-p481/gems/faraday-0.9.1/lib/faraday/connection.rb:377:in `run_request'
        from /Users/brian/.rvm/gems/ruby-2.0.0-p481/gems/faraday-0.9.1/lib/faraday/connection.rb:140:in `get'
        from /Users/brian/.rvm/gems/ruby-2.0.0-p481/gems/vmfloaty-0.5.0/lib/vmfloaty/pooler.rb:9:in `list'
        from /Users/brian/.rvm/gems/ruby-2.0.0-p481/gems/vmfloaty-0.5.0/lib/vmfloaty.rb:103:in `block (2 levels) in run'
        from /Users/brian/.rvm/gems/ruby-2.0.0-p481/gems/commander-4.3.5/lib/commander/command.rb:178:in `call'
        from /Users/brian/.rvm/gems/ruby-2.0.0-p481/gems/commander-4.3.5/lib/commander/command.rb:178:in `call'
        from /Users/brian/.rvm/gems/ruby-2.0.0-p481/gems/commander-4.3.5/lib/commander/command.rb:153:in `run'
        from /Users/brian/.rvm/gems/ruby-2.0.0-p481/gems/commander-4.3.5/lib/commander/runner.rb:428:in `run_active_command'
        from /Users/brian/.rvm/gems/ruby-2.0.0-p481/gems/commander-4.3.5/lib/commander/runner.rb:68:in `run!'
        from /Users/brian/.rvm/gems/ruby-2.0.0-p481/gems/commander-4.3.5/lib/commander/delegates.rb:15:in `run!'
        from /Users/brian/.rvm/gems/ruby-2.0.0-p481/gems/vmfloaty-0.5.0/lib/vmfloaty.rb:348:in `run'
        from /Users/brian/.rvm/gems/ruby-2.0.0-p481/gems/vmfloaty-0.5.0/bin/floaty:7:in `<top (required)>'
        from /Users/brian/.rvm/gems/ruby-2.0.0-p481/bin/floaty:23:in `load'
        from /Users/brian/.rvm/gems/ruby-2.0.0-p481/bin/floaty:23:in `<main>'
        from /Users/brian/.rvm/gems/ruby-2.0.0-p481/bin/ruby_executable_hooks:15:in `eval'
        from /Users/brian/.rvm/gems/ruby-2.0.0-p481/bin/ruby_executable_hooks:15:in `<main>'

/cc @cbrock @whopper since both of you have ran into this issue.

briancain added a commit that referenced this issue Aug 26, 2016
Prior to this commit, if a user provided a url without HTTP or HTTPS
Faraday would fail to make a connection to the pooler since it doesn't
seem to handle urls without that. This commit adds a simple check to see
what kind of URI the user gave us, and if its missing that protocol add
it to the beginning of the URL before making a request.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant