Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #23145 - handle strong params for compute attributes on failure #5412

Merged
merged 1 commit into from
Apr 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ def load_vars_for_ajax
return unless @host

taxonomy_scope
if @host.compute_resource_id && params[:host] && params[:host][:compute_attributes]
@host.compute_attributes = params[:host][:compute_attributes]
if @host.compute_resource_id &&
respond_to?(:host_params) && host_params && host_params[:compute_attributes]
@host.compute_attributes = host_params[:compute_attributes]
end

set_class_variables(@host)
Expand Down
2 changes: 1 addition & 1 deletion app/models/compute_resources/foreman/model/openstack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def volume_client
end

def vm_instance_defaults
super.merge(:key_name => key_pair.name, :metadata => {})
super.merge(:key_name => key_pair.try(:name), :metadata => {})
end

def assign_floating_ip(address, vm)
Expand Down
2 changes: 1 addition & 1 deletion app/models/concerns/orchestration/compute.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def compute_object
# this is mostly relevant when the orchestration had a failure, and later on in the ui we try to retrieve the server again.
# or when the server was removed not via foreman.
elsif compute_resource_id.present? && compute_attributes
compute_resource.new_vm compute_attributes rescue nil
compute_resource.new_vm compute_attributes
end
end

Expand Down