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

Add PxeServer.verify_depot_settings_queue #21013

Merged
merged 1 commit into from
May 14, 2021
Merged
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
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",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is i18n compliant. @mzazrivec can you remind me of the right way to do this?

Copy link
Member

@Fryguy Fryguy Feb 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's

Suggested change
:action => "Verify #{display_name} Credentials",
:action => _("Verify %{display_name} Credentials") % {:display_name => display_name}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Fryguy correct

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This action would be logged into the log file and saved into task's message column. Do we really need to make it I18N compliant? @Fryguy

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the message ends up in a log file, then no, we're not translating that.

: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