Skip to content

Commit

Permalink
Process PackagesProposal packages during autoupgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
imobachgs committed May 13, 2021
1 parent bebef80 commit 453ade8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/lib/autoinstall/clients/inst_autosetup_upgrade.rb
Expand Up @@ -18,6 +18,7 @@
Yast.import "Language"
Yast.import "PackageCallbacks"
Yast.import "Packages"
Yast.import "PackagesProposal"
Yast.import "Pkg"
Yast.import "Popup"
Yast.import "Product"
Expand Down Expand Up @@ -169,12 +170,6 @@ def main
Progress.NextStage
return :abort unless suse_register

software_upgrade

return :abort if UI.PollInput == :abort && Popup.ConfirmAbort(:painless)

Progress.NextStage

# Bootloader
# FIXME: De-duplicate with inst_autosetup
# Bootloader import / proposal is necessary to match changes done for manual
Expand All @@ -197,6 +192,12 @@ def main
["Import", Ops.get_map(Profile.current, "bootloader", {})]
)

Progress.NextStage

return :abort if UI.PollInput == :abort && Popup.ConfirmAbort(:painless)

software_upgrade

# SLES only, the only way to have kdump configured immediately after upgrade
if Builtins.haskey(Profile.current, "kdump")
Call.Function(
Expand Down Expand Up @@ -283,8 +284,8 @@ def progress_stages
_("Configure General Settings "),
_("Set up language"),
_("Registration"),
_("Configure Software selections"),
_("Configure Bootloader"),
_("Configure Software selections"),
_("Confirm License")
]
end
Expand All @@ -294,8 +295,8 @@ def progress_descriptions
_("Configuring general settings..."),
_("Setting up language..."),
_("Registering the system..."),
_("Configuring Software selections..."),
_("Configuring Bootloader..."),
_("Configuring Software selections..."),
_("Confirming License...")
]
end
Expand Down Expand Up @@ -367,8 +368,10 @@ def software_upgrade
Builtins.foreach(sys_patterns) do |pat|
Pkg.ResolvableInstall(pat, :pattern)
end

# this is new, (de)select stuff from the profile
packages = Profile.current["software"]&.public_send(:[], "packages") || []
packages += Yast::PackagesProposal.GetAllResolvables(:package)
patterns = Profile.current["software"]&.public_send(:[], "patterns") || []
products = Profile.current["software"]&.public_send(:[], "products") || []
remove_packages = Profile.current["software"]&.public_send(:[], "remove-packages") || []
Expand Down
13 changes: 13 additions & 0 deletions test/lib/clients/inst_autosetup_upgrade_test.rb
Expand Up @@ -117,5 +117,18 @@

expect(Yast::AutoinstConfig.Confirm).to eq true
end

context "when a package is proposed for installation" do
before do
allow(Yast::WFM).to receive(:CallFunction).with("bootloader_auto", any_args) do
Yast::PackagesProposal.AddResolvables("yast2-bootloader", :package, ["shim"])
end
end

it "install those packages" do
expect(Yast::Pkg).to receive(:ResolvableInstall).with("shim", :package)
subject.main
end
end
end
end

0 comments on commit 453ade8

Please sign in to comment.