Skip to content

Commit

Permalink
fixup! Filter out non-registered hosts from affected systems in SUMA …
Browse files Browse the repository at this point in the history
…patch detail
  • Loading branch information
dottorblaster committed Sep 13, 2024
1 parent ae5bed7 commit a08be40
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ defmodule Trento.Infrastructure.SoftwareUpdates.MockSuma do
{:ok,
[
%{
name: "test"
name: "vmdbrbddev01"
},
%{name: "test2"}
%{name: "vmdrbddev02"}
]}

@impl true
Expand Down
10 changes: 4 additions & 6 deletions lib/trento_web/controllers/v1/suse_manager_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,15 @@ defmodule TrentoWeb.V1.SUSEManagerController do
{:ok, fixes} <- Discovery.get_bugzilla_fixes(advisory_name),
{:ok, affected_packages} <- Discovery.get_affected_packages(advisory_name),
{:ok, affected_systems} <- Discovery.get_affected_systems(advisory_name) do
filtered_affected_systems =
Enum.filter(affected_systems, fn %{name: system} ->
Enum.member?(registered_hosts, system)
end)

render(conn, %{
errata_details: errata_details,
cves: cves,
fixes: fixes,
affected_packages: affected_packages,
affected_systems: filtered_affected_systems
affected_systems:
Enum.filter(affected_systems, fn %{name: system} ->
Enum.member?(registered_hosts, system)
end)
})
end
end
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/cypress/e2e/suse_manager_overviews.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ context('SUSE Manager overviews', () => {
cy.contains('Affected Packages').next().should('contain', 'kernel');
cy.contains('Affected Systems')
.next()
.should('contain', 'test')
.should('contain', 'test2');
.should('contain', 'vmdrbddev01')
.should('contain', 'vmdrbddev02');

cy.clearSUMASettings();
});
Expand Down

0 comments on commit a08be40

Please sign in to comment.