Sha256: 1494fa4cd3c3271024679326d084abd670666f48878b2380afeab6c970a1f67a
Contents?: true
Size: 1.12 KB
Versions: 1
Compression:
Stored size: 1.12 KB
Contents
module ForemanAzureRM module Concerns module HostsControllerExtensions def sizes if (azure_rm_resource = Image.unscoped.find_by_uuid(params[:image_id])).present? resource = azure_rm_resource.compute_resource render :json => resource.vm_sizes(params[:region_string]).map { |size| size.name } else no_sizes = _('The region you selected has no sizes associated with it') render :json => "[\"#{no_sizes}\"]" end end def subnets azure_rm_image = Image.unscoped.find_by_uuid(params[:image_id]) if azure_rm_image.present? azure_rm_resource = azure_rm_image.compute_resource subnets = azure_rm_resource.subnets(params[:region]) if subnets.present? render :json => subnets else no_subnets = _('The selected region has no subnets') render :json => "[\"#{no_subnets}\"]" end else no_compute = _('The selected image has no associated compute resource') render :json => "[\"#{no_compute}\"]" end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
foreman_azure_rm-2.0.0.pre1 | app/controllers/foreman_azure_rm/concerns/hosts_controller_extensions.rb |