Module: ForemanAzure::Concerns::HostsControllerExtensions

Defined in:
app/controllers/foreman_azure/concerns/hosts_controller_extensions.rb

Instance Method Summary collapse

Instance Method Details

#locationsObject



4
5
6
7
8
9
10
11
12
13
14
15
# File 'app/controllers/foreman_azure/concerns/hosts_controller_extensions.rb', line 4

def locations
  if (azure_resource = Image.unscoped.find_by_uuid(params[:image_id])).present?
    render :json => azure_resource.compute_resource.
      image_locations(params[:image_id])
  else
    error = _('The operating system you selected has no associated image.'\
              ' Please select a different one or go to Infrastructure >'\
              ' Compute Resources to associate an image with this '\
              'operating system.')
    render :json => "[\"#{error}\"]"
  end
end