ManageIQ / azure-armrest

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

Add a customizable method that can disable key transformation #368

Closed djberg96 closed 6 years ago

djberg96 commented 6 years ago

In version 0.8.2 we added the ability to allow either lower_case or camelCase options for the create method. This convenience was handy and consistent with our model generation methods.

However, this caused a bug in the TemplateDeploymentService#create method where you don't actually want to transform keys in templates, but keep them as-is, because they aren't interchangeable.

This PR fixes the issue by updating the ResourceGroupBasedService and TemplateDeploymentService. From now on it will use the private method transform_keys? internally to check to see if the keys should be transformed first. Individual subclasses can override this method simply by redefining it to return false.

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

Update: as per Bill's request, the method was altered so that subclasses have more granular control over which keys are transformed.

JPrause commented 6 years ago

@miq-bot add_label blocker

JPrause commented 6 years ago

@djberg96 can you add the gaprindashvili/yes label if this can be backported.

miq-bot commented 6 years ago

@JPrause Cannot apply the following label because they are not recognized: blocker

djberg96 commented 6 years ago

@JPrause This wouldn't be directly backported. I would release a new version of the gem, then submit a gemspec update to the azure provider repo. That PR would then be tagged.

miq-bot commented 6 years ago

Checked commit https://github.com/djberg96/azure-armrest/commit/e12d158ef3b6626bf7c5dbfaaa7ebe52a21a8315 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 5 files checked, 10 offenses detected

lib/azure/armrest.rb

lib/azure/armrest/resource_group_based_service.rb

spec/resource_group_based_service_spec.rb

spec/template_deployment_service_spec.rb