Module: ForemanAzureRm::Concerns::HostsControllerExtensions
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/controllers/foreman_azure_rm/concerns/hosts_controller_extensions.rb
Instance Method Summary collapse
Instance Method Details
#sizes ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'app/controllers/foreman_azure_rm/concerns/hosts_controller_extensions.rb', line 6 def sizes azure_rm_resource = ComputeResource.unscoped.find_by_id(params[:compute_resource_id]) if azure_rm_resource.present? render :json => azure_rm_resource.vm_sizes.map { |size| size.name } else no_sizes = _('The region you selected has no sizes associated with it') render :json => "[\"#{no_sizes}\"]" end end |
#subnets ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/controllers/foreman_azure_rm/concerns/hosts_controller_extensions.rb', line 16 def subnets azure_rm_resource = ComputeResource.unscoped.find_by_id(params[:compute_resource_id]) if azure_rm_resource.present? subnets = azure_rm_resource.subnets 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 |