ManageIQ / azure-armrest

Ruby interface for Azure using the new REST API
Apache License 2.0
15 stars 36 forks source link

Fix and update the ResourceProviderService#list_api_versions method #374

Closed djberg96 closed 6 years ago

djberg96 commented 6 years ago

Currently the ResourceProviderService#list_api_versions method is broken. At the moment it always grabs the first result from the response. I think I did this because originally there was only ever one service per resource, but that changed a while ago and I never updated it. That, or it's always been broken and we never noticed since it's not used internally.

So, this PR modifies the list_api_versions method to require both a namespace and a service name, as it wouldn't make sense without both arguments. If a valid service name cannot be found, an ArgumentError is raised.

This is needed as part of an effort to handle invalid api-version strings in the ManageIQ Azure provider code.

https://bugzilla.redhat.com/show_bug.cgi?id=1566613

miq-bot commented 6 years ago

Checked commit https://github.com/djberg96/azure-armrest/commit/96492b847a37eca397227f299194319dd2c6f03e with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 2 files checked, 1 offense detected

**

2 errors occurred: An error occurred while Style/PercentLiteralDelimiters cop was inspecting /tmp/d20180711-1418-12w92ce/spec/resource_provider_spec.rb:88:14. An error occurred while Style/PercentLiteralDelimiters cop was inspecting /tmp/d20180711-1418-12w92ce/spec/resource_provider_spec.rb:94:14. Errors are usually caused by RuboCop bugs. Please, report your problems to RuboCop's issue tracker. Mention the following information in the issue report: 0.52.1 (using Parser 2.5.0.2, running on ruby 2.3.3 x86_64-linux)

bzwei commented 6 years ago

Who currently calls list_api_versions? Will it break the backward compatibility by changing the argument list?

djberg96 commented 6 years ago

@bzwei Nothing calls it internally or in the Azure provider code, and it's broken anyway, so backwards compatibility isn't really affected.