Skip to content

Commit

Permalink
make rubocop happy
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Dec 14, 2023
1 parent 93c7b7f commit 5b5a303
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 16 deletions.
11 changes: 6 additions & 5 deletions src/lib/y2firstboot/clients/wsl_product_selection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ def run
return :auto if products.none?

dialog = Dialogs::WSLProductSelection.new(products,
default_product: product,
wsl_gui_pattern: wsl_gui_pattern?,
default_product: product,
wsl_gui_pattern: wsl_gui_pattern?,
wsl_systemd_pattern: wsl_systemd_pattern?)

result = dialog.run

if result == :next
save(product: dialog.product,
wsl_gui_pattern: dialog.wsl_gui_pattern,
save(product: dialog.product,
wsl_gui_pattern: dialog.wsl_gui_pattern,
wsl_systemd_pattern: dialog.wsl_systemd_pattern)
end

Expand Down Expand Up @@ -137,7 +137,8 @@ def wsl_systemd_pattern=(value)
# @see Registration::Storage::InstallationOptions
def update_registration
yaml_product = WSLConfig.instance.product
force_registration = WSLConfig.instance.product_switched? || wsl_gui_pattern? | wsl_systemd_pattern?
force_registration = WSLConfig.instance.product_switched? ||
wsl_gui_pattern? || wsl_systemd_pattern?

Registration::Storage::InstallationOptions.instance.yaml_product = yaml_product
Registration::Storage::InstallationOptions.instance.force_registration = force_registration
Expand Down
10 changes: 7 additions & 3 deletions src/lib/y2firstboot/dialogs/wsl_product_selection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ class WSLProductSelection < ::UI::InstallationDialog
# @param products [Array<Hash>] All possible products
# @param default_product [Hash] Product selected by default
# @param wsl_gui_pattern [Boolean] Whether WSL GUI pattern is selected by default
def initialize(products, default_product: nil, wsl_gui_pattern: false, wsl_systemd_pattern: false)
# @param wsl_systemd_pattern [Boolean] Whether WSL systemd pattern is selected by default
def initialize(products, default_product: nil, wsl_gui_pattern: false,
wsl_systemd_pattern: false)
textdomain "firstboot"

super()
Expand Down Expand Up @@ -111,10 +113,12 @@ def help_text
_("<p>Select the product to use with Windows Subsystem for Linux (WSL). " \
"Some products might require registration.</p>") +
# TRANSLATORS: help text (2/3)
_("<p>For smoother experience with graphical programs in WSL the WSL GUI pattern provides recommended config, tools and libraries. " \
_("<p>For smoother experience with graphical programs in WSL " \
"the WSL GUI pattern provides recommended config, tools and libraries. " \
"In that case the system needs to be registered as well.</p>") +
# TRANSLATORS: help text (3/3)
_("<p>For enablement of systemd in WSL the WSL systemd pattern provides wsl.conf and /sbin/init adjustments. " \
_("<p>For enablement of systemd in WSL the WSL systemd pattern provides wsl.conf " \
"and /sbin/init adjustments. " \
"In that case the system needs to be registered as well.</p>")
end

Expand Down
6 changes: 3 additions & 3 deletions test/y2firstboot/clients/wsl_product_selection_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ class InstallationOptions

let(:dialog) do
instance_double(Y2Firstboot::Dialogs::WSLProductSelection,
run: dialog_result,
product: selected_product,
wsl_gui_pattern: wsl_gui_pattern,
run: dialog_result,
product: selected_product,
wsl_gui_pattern: wsl_gui_pattern,
wsl_systemd_pattern: wsl_systemd_pattern)
end

Expand Down
10 changes: 5 additions & 5 deletions test/y2firstboot/dialogs/wsl_product_selection_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,9 @@ def find_widget(regexp, content)

subject do
described_class.new(products,
default_product: default_product,
wsl_gui_pattern: wsl_gui_pattern,
wsl_systemd_pattern: wsl_systemd_pattern
)
default_product: default_product,
wsl_gui_pattern: wsl_gui_pattern,
wsl_systemd_pattern: wsl_systemd_pattern)
end

let(:products) { [sles, sled] }
Expand Down Expand Up @@ -141,7 +140,8 @@ def find_widget(regexp, content)
before do
allow(Yast::UI).to receive(:QueryWidget).and_call_original
allow(Yast::UI).to receive(:QueryWidget).with(Id(:wsl_gui_pattern), :Value).and_return(true)
allow(Yast::UI).to receive(:QueryWidget).with(Id(:wsl_systemd_pattern), :Value).and_return(true)
allow(Yast::UI).to receive(:QueryWidget).with(Id(:wsl_systemd_pattern), :Value)
.and_return(true)
allow(Yast::UI).to receive(:QueryWidget).with(Id(:product_selector), :Value)
.and_return("SLES:15.4")
end
Expand Down

0 comments on commit 5b5a303

Please sign in to comment.