chef / knife-vrealize

Plugin for Chef's knife tool to interact with VMware vRealize products
Apache License 2.0
13 stars 13 forks source link

knife[:vra_base_url] causes an error if URL has a trailing slash #24

Closed vinyar closed 7 years ago

vinyar commented 7 years ago

The resulting error is 'HTTPNotFound' Removing trailing slash fixes the issue.

Expectation: Presence of trailing slash makes no difference.

bad: knife[:vra_base_url] = 'https://vra.corp.local/'

good: knife[:vra_base_url] = 'https://vra.corp.local'

vinyar commented 7 years ago

Would this work:

         includer.class_eval do
            option :vra_base_url,
              long:        '--vra-base-url API_URL',
              description: 'URL for the vRA server',
              proc:        proc { |url| url.sub(/(\/)+$/,'') }

https://github.com/chef-partners/knife-vrealize/blob/0c793ca5aad23282611093cc98a08a130ca2c717/lib/chef/knife/cloud/vra_service_options.rb#L30

jjasghar commented 7 years ago

This seems pretty reasonable. I'd have to verify it on a vRA instance though. Can you put a PR in for the change?