puppetlabs / puppetlabs-azure_arm

The Puppet Azure ARM Module
Apache License 2.0
4 stars 16 forks source link

Attempting a new "azure_server_farm_with_rich_sku" leads to "Invalid Parameter: allow_pending_state" #15

Closed Monual closed 5 years ago

Monual commented 5 years ago

What you expected to happen?

A new App Service Plan to be deployed

What happened?

Error: Invalid parameter allow_pending_state(:allow_pending_state)
Error: /Stage[main]/Azuretest/Azure_server_farm_with_rich_sku[resource myappservicename]/ensure: change from 'absent' to 'present' failed: Invalid parameter allow_pending_state(:allow_pending_state)

How to reproduce it?

Attempt to create any new resource using azure_app_server_farm_with_rich_sku

Anything else we need to know?

Looking at the code, it's clearly looking for a parameter called "allowPendingState":

  def self.invoke_create(resource = nil, body_params = nil)
    key_values = self.build_key_values
    Puppet.info("Calling operation ServerFarms_CreateOrUpdateServerFarm")
    path_params = {}
    query_params = {}
    header_params = {}
    header_params["User-Agent"] = "puppetlabs-azure_arm/0.2.1"

    op_params = [
      self.op_param("allowPendingState", "query", "allow_pending_state", "allow_pending_state"),
      .
      .
      .
    ]

Yet nowhere in the documentation is that parameter defined or listed as "required". Indeed, according to http://superyyrrzz.github.io/NODE/azure-arm-website/azure-arm-website.ServerFarms.html, the parameter is OBSOLETE.

Adding a dummy "allow_pending_state => true" led to a new error message:

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: no parameter named 'allow_pending_state' 

So azure_server_farm_with_rich_sku fails because it requires a parameter it won't allow you to specify.

Monual commented 5 years ago

As a note: For a quick hack, I commented out this line in two places in /lib/puppet/provider/azure_server_farm_with_rich_sku/azure_server_farm_with_rich_sku.rb:

self.op_param("allowPendingState", "query", "allow_pending_state", "allow_pending_state"),

I then did a "chattr +i" on that file. My code deploys now throw up sync-errors, but I was able to deploy my azure_server_farm_with_rich_sku resource just fine.

Monual commented 5 years ago

I created a PR just so I could pull that into my own environment:

https://github.com/puppetlabs/puppetlabs-azure_arm/pull/16

sheenaajay commented 5 years ago

Thank you @Monual for your contribution.Will be taking a look on the issue.Thank you.

sheenaajay commented 5 years ago

@Monual Thanks a lot for raising the Issue and the PR.The fix is available in the master.Apologies for the delay.