Project

General

Profile

« Previous | Next » 

Revision 6085426b

Added by Ben Plessinger almost 6 years ago

Fixes #23479 - Enhance OpenStack VM Creation

  • Fixes #23479 - Enhance OpenStack VM Creation
  • Fixes #23479 - check property exists before access

View differences:

app/models/compute_resources/foreman/model/openstack.rb
# fix internal network format for fog.
args[:nics].delete_if(&:blank?)
args[:nics].map! {|nic| { 'net_id' => nic } }
args[:security_groups].delete_if(&:blank?) if args[:security_groups].present?
format_scheduler_hint_filter(args) if args[:scheduler_hint_filter].present?
vm = super(args)
if network.present?
app/views/compute_resources_vms/form/openstack/_base.html.erb
arch ||= nil ; os ||= nil
images = possible_images(compute_resource, arch, os)
%>
<%= selectable_f f, :availability_zone, compute_resource.zones, {:include_blank => _("No preference")}, :label => _('Availability zone'), :label_size => "col-md-2" %>
<%= selectable_f f, :availability_zone, compute_resource.zones,
{:inculde_blank => (compute_resource.zones.empty? || compute_resource.zones.size == 1) ? false : _("No preference") },
:label => _('Availability zone'), :label_size => "col-md-2" %>
<div id='image_selection'>
<%= select_f f, :image_ref, images, :uuid, :name,
{ :include_blank => (images.empty? || images.size == 1) ? false : _('Please select an image') },
......
</div>
<%= select_f f, :tenant_id, compute_resource.tenants, :id, :name, {}, :label => _('Tenant'), :label_size => "col-md-2" %>
<%= select_f f, :security_groups, compute_resource.security_groups, :name, :name, {}, :label => _("Security group"), :label_size => "col-md-2" %>
<%= select_f f, :security_groups, compute_resource.security_groups, :name, :name, {}, { :label => _("Security groups"), :label_size => "col-md-2", :multiple => true} %>
<%= select_f f, :nics, compute_resource.internal_networks, :id, :name,
{}, { :label => _('Internal network'), :label_size => "col-md-2", :multiple => true } %>
<%= selectable_f f, :network, compute_resource.address_pools, { include_blank: 'None' }, { :label => _("Floating IP network"), :label_size => "col-md-2" } %>

Also available in: Unified diff