Skip to content

Commit

Permalink
using params for conversion_host
Browse files Browse the repository at this point in the history
  • Loading branch information
jameswnl committed Nov 13, 2018
1 parent b964ba6 commit 0285ef2
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions app/models/conversion_host.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,17 +110,18 @@ def self.enable_queue(params, auth_user = nil)
end

def self.enable(params)
op_arg = params.each_with_object([]) { |(k, v), l| l.push("#{k}=#{v}") }.join(', ')
_log.info("Enabling a conversion_host with parameters: #{op_arg}")

success = false
resource_info = 'not found/invalid'

op_arg = params.each_with_object([]) { |(k, v), l| l.push("#{k}=#{v}") }.join(', ')
_log.info "Enabling a conversion_host with parameters: #{op_arg}"

resource_type = params[:resource_type]
vddk_url = params.delete("param_v2v_vddk_package_url")
resource_id = params[:resource_id]
resource_type = params[:resource_type]
resource = resource_type.constantize.find(resource_id)

success = create!(:resource => resource)
success = create!(params)
resource_info = "type=#{params[:resource_type]} id=#{params[:resource_id]}"
ensure
notify_configuration_result('enable', success, resource_info)
Expand All @@ -137,7 +138,7 @@ def disable(params)
resource_info = "type=#{resource.class.name} id=#{resource.id}"

op_arg = params.each_with_object([]) { |(k, v), l| l.push("#{k}=#{v}") }.join(', ')
_log.info "Disabling a conversion_host with parameters: #{op_arg}"
_log.info("Disabling a conversion_host with parameters: #{op_arg}")

success = destroy
ensure
Expand Down

0 comments on commit 0285ef2

Please sign in to comment.