Actions
Bug #32555
closedazure_environment (cloud) should have a default
Difficulty:
Triaged:
Yes
Description
#31188 introduced support for selecting which cloud you deploy on.
but now, when you create a CR via the API, and don't pass "cloud" as one of the params (it's not marked as required) you just get an error:
2021-05-06T13:56:48 [I|app|1151b2a1] Processing by Api::V2::ComputeResourcesController#create as JSON 2021-05-06T13:56:48 [I|app|1151b2a1] Parameters: {"compute_resource"=>{"name"=>"azure", "provider"=>"AzureRm", "user"=>"UUID", "password"=>"[FILTERED]", "region"=>"westeurope", "tenant" =>"UUID", "app_ident"=>"UUID"}, "apiv"=>"v2"} 2021-05-06T13:56:48 [W|app|1151b2a1] Action failed 2021-05-06T13:56:48 [I|app|1151b2a1] Backtrace for 'Action failed' error (NoMethodError): undefined method `downcase' for nil:NilClass 1151b2a1 | /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_azure_rm-2.2.3/lib/foreman_azure_rm/azure_sdk_adapter.rb:60:in `ad_environment_settings' 1151b2a1 | /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_azure_rm-2.2.3/lib/foreman_azure_rm/azure_sdk_adapter.rb:9:in `initialize' 1151b2a1 | /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_azure_rm-2.2.3/app/models/foreman_azure_rm/azure_rm.rb:54:in `new' 1151b2a1 | /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_azure_rm-2.2.3/app/models/foreman_azure_rm/azure_rm.rb:54:in `sdk' 1151b2a1 | /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_azure_rm-2.2.3/app/models/foreman_azure_rm/azure_rm.rb:84:in `regions' 1151b2a1 | /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_azure_rm-2.2.3/app/models/foreman_azure_rm/azure_rm.rb:66:in `validate_region' 1151b2a1 | /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_azure_rm-2.2.3/app/models/foreman_azure_rm/azure_rm.rb:62:in `ensure_attributes_and_values'
IMHO this should just default to "azure" and let the user override it if they think they need to
Actions