Closed Monual closed 5 years ago
Thank you @Monual for your contribution.Will be taking a look on the issue.Thank you.
Some additional commentary while I was trying to get this to work:
lib/puppet/type/azure_sql_database.rb
lists these required properties:
required_properties = [
:location,
:elastic_pool_name,
:parameters,
:recommended_elastic_pool_name,
:resource_group_name,
:server_name,
]
This is wrong in multiple ways. elastic_pool_name
and recommended_elastic_pool_name
are not required. However, subscription_id
, and api_version_name
are required.
Also, elastic_pool_name
and recommended_elastic_pool_name
weren't even defined as properties. I had to add the following to azure_sql_database.rb::
newproperty(:elastic_pool_name) do
desc "Elastic Pool Name."
validate do |value|
true
end
end
newproperty(:recommended_elastic_pool_name) do
desc "Recommended Elastic Pool Name."
validate do |value|
true
end
end
Also, there are two lines in lib/puppet/provider/azure_sql_database/azure_sql_database.rb
that assume that elastic_pool_name
and recommended_elastic_pool_name
are required parameters. I changed them from:
self.call_op(path_params, query_params, header_params, body_params, "management.azure.com", "/subscriptions/%{subscription_id}/resourceGroups/%{resource_group_name}/providers/Microsoft.Sql/servers/%{server_name}/elasticPools/%{elastic_pool_name}/databases", "Get", "[application/json]")
self.call_op(path_params, query_params, header_params, body_params, "management.azure.com", "/subscriptions/%{subscription_id}/resourceGroups/%{resource_group_name}/providers/Microsoft.Sql/servers/%{server_name}/recommendedElasticPools/%{recommended_elastic_pool_name}/databases/%{database_name}", "Get", "[application/json]")
to:
defined?(elastic_pool_name) && self.call_op(path_params, query_params, header_params, body_params, "management.azure.com", "/subscriptions/%{subscription_id}/resourceGroups/%{resource_group_name}/providers/Microsoft.Sql/servers/%{server_name}/elasticPools/%{elastic_pool_name}/databases", "Get", "[application/json]")
defined?(recommended_elastic_pool_name) && self.call_op(path_params, query_params, header_params, body_params, "management.azure.com", "/subscriptions/%{subscription_id}/resourceGroups/%{resource_group_name}/providers/Microsoft.Sql/servers/%{server_name}/recommendedElasticPools/%{recommended_elastic_pool_name}/databases/%{database_name}", "Get", "[application/json]")
After I did all of the above, I got my SQL database to deploy.
I will put in a PR, likely tomorrow.
@Monual Thanks a lot for raising the Issue and the PR.The fix is available in the master.Apologies for the delay.
What you expected to happen?
A new Microsoft SQL server to be deployed.
What happened?
Error: Failed to apply catalog: Validation of Azure_sql_database[wre-dellegance-db-copy] failed: Invalid parameterelastic_pool_name(:elastic_pool_name
Anything else we need to know?
"elastic_pool_name" is an optional parameter according to the documentation. I didn't have that parameter in my manifest at all. Yet the module failed because it said a parameter I didn't even supply was invalid.
I tried specifying an elastic_pool_name, just to see what would happen, and got the same error.
Versions:
This one has me stumped, although I haven't done a deep dive into the code yet.