Azure / azure-sdk-for-ruby

Ruby SDK for Azure Resource Manager: build and manage your Azure cloud infrastructure (Compute, Virtual Networks, Storage, etc...) using Ruby.
MIT License
275 stars 246 forks source link

Issue listing more than one image in a shared gallery #2822

Closed chris1984 closed 3 years ago

chris1984 commented 3 years ago

Hi,

I have 3 images in a shared image gallery. I can add the first one fine, but when I try to add the others I get the following error:

Failed to save: UUID could not be found in Azure

I can see the images come back correctly here in pry:

11:48:36 rails.1   | [4] pry(#<ForemanAzureRm::AzureRm>)> gallery_images_list
11:48:37 rails.1   | => [#<Azure::Resources::Mgmt::V2019_07_01::Models::GenericResource:0x00007f03e87859e0
11:48:37 rails.1   |   @id="/subscriptions/f5877eb3-9016-4ddd-80b1-3657c9fdbed8/resourceGroups/RHSatellite/providers/Microsoft.Compute/galleries/SatTesting/images/ToledoImg",
11:48:37 rails.1   |   @location="eastus",
11:48:37 rails.1   |   @name="SatTesting/ToledoImg",
11:48:37 rails.1   |   @tags={},
11:48:37 rails.1   |   @type="Microsoft.Compute/galleries/images">,
11:48:37 rails.1   |  #<Azure::Resources::Mgmt::V2019_07_01::Models::GenericResource:0x00007f040810bb08
11:48:37 rails.1   |   @id="/subscriptions/f5877eb3-9016-4ddd-80b1-3657c9fdbed8/resourceGroups/RHSatellite/providers/Microsoft.Compute/galleries/SatTesting/images/ToledoRHEL",
11:48:37 rails.1   |   @location="eastus",
11:48:37 rails.1   |   @name="SatTesting/ToledoRHEL",
11:48:37 rails.1   |   @tags={},
11:48:37 rails.1   |   @type="Microsoft.Compute/galleries/images">,
11:48:37 rails.1   |  #<Azure::Resources::Mgmt::V2019_07_01::Models::GenericResource:0x00007f0408108d90
11:48:37 rails.1   |   @id="/subscriptions/f5877eb3-9016-4ddd-80b1-3657c9fdbed8/resourceGroups/RHSatellite/providers/Microsoft.Compute/galleries/SatTesting/images/ToledoSpec",
11:48:37 rails.1   |   @location="eastus",
11:48:37 rails.1   |   @name="SatTesting/ToledoSpec",
11:48:37 rails.1   |   @tags={},
11:48:37 rails.1   |   @type="Microsoft.Compute/galleries/images">]

Here is the code we are using to pull the images with the SDK:

https://github.com/theforeman/foreman_azure_rm/blob/master/app/models/foreman_azure_rm/azure_rm.rb#L160

Where we get the empty array is on this guy:

https://github.com/theforeman/foreman_azure_rm/blob/master/lib/foreman_azure_rm/azure_sdk_adapter.rb#L165-L167

Since we are getting the empty array on an SDK call, is there a bug with the SDK or is it something we are not doing correctly?