ggiamarchi / vagrant-openstack-provider

Use Vagrant to manage OpenStack Cloud instances.
MIT License
247 stars 101 forks source link

URI::InvalidError when Openstack tenant name has whitespace #223

Open beol opened 9 years ago

beol commented 9 years ago

Our tenant name has whitespaces in it. This causes problem whenever calls to http_utils.rb requires tenant name in the URL.

[llaksmana@llaksmana-ml:vagrant_openstack]$ vagrant up
Bringing machine 'default' up with 'openstack' provider...
==> default: Finding flavor for server...
An unknow error happened in Vagrant OpenStack provider

To easily debug what happened, we recommend to set the environment
variable VAGRANT_OPENSTACK_LOG to debug

    $ export VAGRANT_OPENSTACK_LOG=debug

If doing this does not help fixing your issue, there may be a bug
in the provider. Please submit an issue on Github at
https://github.com/ggiamarchi/vagrant-openstack-provider
with the stracktrace and the logs.

We are looking for feedback, so feel free to ask questions or
describe features you would like to see in this provider.
/opt/vagrant/embedded/lib/ruby/2.0.0/uri/common.rb:176:in `split': Catched Error: Catched Error: Catched Error: Catched Error: bad URI(is not URI?): http://10.6.43.151:8774/v2/Internal Systems (Cloud)/flavors/detail (URI::InvalidURIError)
    from /opt/vagrant/embedded/lib/ruby/2.0.0/uri/common.rb:211:in `parse'
    from /opt/vagrant/embedded/lib/ruby/2.0.0/uri/common.rb:747:in `parse'
    from /opt/vagrant/embedded/gems/gems/rest-client-1.6.8/lib/restclient/request.rb:116:in `parse_url'
    from /opt/vagrant/embedded/gems/gems/rest-client-1.6.8/lib/restclient/request.rb:120:in `parse_url_with_auth'
    from /opt/vagrant/embedded/gems/gems/rest-client-1.6.8/lib/restclient/request.rb:67:in `execute'
    from /opt/vagrant/embedded/gems/gems/rest-client-1.6.8/lib/restclient/request.rb:35:in `execute'
    from /Users/llaksmana/.vagrant.d/gems/gems/vagrant-openstack-provider-0.6.1/lib/vagrant-openstack-provider/client/rest_utils.rb:8:in `get'
    from /Users/llaksmana/.vagrant.d/gems/gems/vagrant-openstack-provider-0.6.1/lib/vagrant-openstack-provider/client/http_utils.rb:22:in `block in get'
    from /Users/llaksmana/.vagrant.d/gems/gems/vagrant-openstack-provider-0.6.1/lib/vagrant-openstack-provider/client/http_utils.rb:104:in `authenticated'
    from /Users/llaksmana/.vagrant.d/gems/gems/vagrant-openstack-provider-0.6.1/lib/vagrant-openstack-provider/client/http_utils.rb:21:in `get'
    from /Users/llaksmana/.vagrant.d/gems/gems/vagrant-openstack-provider-0.6.1/lib/vagrant-openstack-provider/client/nova.rb:20:in `get_all_flavors'
    from /Users/llaksmana/.vagrant.d/gems/gems/vagrant-openstack-provider-0.6.1/lib/vagrant-openstack-provider/config_resolver.rb:19:in `resolve_flavor'
    from /Users/llaksmana/.vagrant.d/gems/gems/vagrant-openstack-provider-0.6.1/lib/vagrant-openstack-provider/action/create_server.rb:33:in `execute'
    from /Users/llaksmana/.vagrant.d/gems/gems/vagrant-openstack-provider-0.6.1/lib/vagrant-openstack-provider/action/abstract_action.rb:8:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
    from /Users/llaksmana/.vagrant.d/gems/gems/vagrant-openstack-provider-0.6.1/lib/vagrant-openstack-provider/action/create_stack.rb:46:in `execute'
    from /Users/llaksmana/.vagrant.d/gems/gems/vagrant-openstack-provider-0.6.1/lib/vagrant-openstack-provider/action/abstract_action.rb:8:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
    from /Users/llaksmana/.vagrant.d/gems/gems/vagrant-openstack-provider-0.6.1/lib/vagrant-openstack-provider/action/sync_folders.rb:48:in `call'
    from /Users/llaksmana/.vagrant.d/gems/gems/vagrant-openstack-provider-0.6.1/lib/vagrant-openstack-provider/action/sync_folders.rb:20:in `execute'
    from /Users/llaksmana/.vagrant.d/gems/gems/vagrant-openstack-provider-0.6.1/lib/vagrant-openstack-provider/action/abstract_action.rb:8:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/builtin/provision.rb:80:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/builder.rb:116:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/runner.rb:66:in `block in run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/util/busy.rb:19:in `busy'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/runner.rb:66:in `run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/builtin/call.rb:53:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
    from /Users/llaksmana/.vagrant.d/gems/gems/vagrant-openstack-provider-0.6.1/lib/vagrant-openstack-provider/action/connect_openstack.rb:32:in `execute'
    from /Users/llaksmana/.vagrant.d/gems/gems/vagrant-openstack-provider-0.6.1/lib/vagrant-openstack-provider/action/abstract_action.rb:8:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/builtin/config_validate.rb:25:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/builder.rb:116:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/runner.rb:66:in `block in run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/util/busy.rb:19:in `busy'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/runner.rb:66:in `run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/machine.rb:214:in `action_raw'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/machine.rb:191:in `block in action'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/environment.rb:516:in `lock'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/machine.rb:178:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/machine.rb:178:in `action'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/batch_action.rb:82:in `block (2 levels) in run'

I fixed the problem in the rest_utils.rb by replacing spaces with escaped character of it, %20.

I'm going to submit a pull request for this later.