Skip to content

Commit

Permalink
Add PxeServer.verify_depot_settings_queue
Browse files Browse the repository at this point in the history
  • Loading branch information
lfu committed Mar 1, 2021
1 parent 9909113 commit d892d49
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions app/models/mixins/file_depot_mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,28 @@ module ClassMethods
def verify_depot_settings(settings)
return true unless MiqEnvironment::Command.is_appliance?

settings["password"] ||= find(settings["id"]).authentication_password if settings["id"]
res = mnt_instance(settings).verify
raise _("Connection Settings validation failed with error: %{error}") % {:error => res.last} unless res.first
res
end

def verify_depot_settings_queue(userid, zone, options)
task_opts = {
:action => "Verify #{display_name} Credentials",
:userid => userid
}

queue_opts = {
:class_name => name,
:method_name => "verify_depot_settings",
:args => [options],
:zone => zone
}

MiqTask.generic_action_with_callback(task_opts, queue_opts)
end

def mnt_instance(settings)
settings[:uri_prefix] ||= get_uri_prefix(settings[:uri])
klass = "Miq#{settings[:uri_prefix].capitalize}Session".constantize
Expand Down

0 comments on commit d892d49

Please sign in to comment.