Skip to content

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

Description

@briancain

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions