Skip to content

Commit

Permalink
Do not set resolvables if not configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
teclator committed Jan 4, 2022
1 parent 14d4b3c commit 6ee5ae1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
2 changes: 2 additions & 0 deletions src/modules/Security.rb
Expand Up @@ -932,6 +932,8 @@ def import_lsm_config(settings)
section = Y2Security::AutoinstProfile::SecuritySection.new_from_hashes(settings)
Y2Security::Autoinst::LSMConfigReader.new(section.lsm).read

return unless lsm_config.configurable?

PackagesProposal.SetResolvables("LSM", :pattern, lsm_config.needed_patterns)
end

Expand Down
24 changes: 17 additions & 7 deletions test/security_test.rb
Expand Up @@ -720,13 +720,23 @@ def enabled?
end

context "when a specific Linux Security Module is selected" do
it "sets resolvables for needed patterns" do
allow_any_instance_of(Y2Security::LSM::Base).to receive(:needed_patterns)
.and_return(selinux_patterns)
expect(Yast::PackagesProposal).to receive(:SetResolvables)
.with(anything, :pattern, selinux_patterns)

Security.Import("selinux_mode" => "permissive")
context "and LSM is configurable" do
it "sets resolvables for needed patterns" do
allow_any_instance_of(Y2Security::LSM::Base).to receive(:needed_patterns)
.and_return(selinux_patterns)
expect(Yast::PackagesProposal).to receive(:SetResolvables)
.with(anything, :pattern, selinux_patterns)

Security.Import("selinux_mode" => "permissive")
end
end

context "and LSM is declared as no configurable" do
it "does not touch resolvables" do
expect(Yast::PackagesProposal).to_not receive(:SetResolvables)

Security.Import("lsm" => { "configurable" => false })
end
end
end

Expand Down

0 comments on commit 6ee5ae1

Please sign in to comment.