-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Track software update discoveries (#2540)
* Add a DiscoveryResult schema in order to keep track of software updates discovery results * Store software updates discovery results on successful discovery * Add tracking of both successful and failing software updates discoveries * Integrate clearup of tracked software updates discoveries * Properly track discoveries failing due to authentication issues
- Loading branch information
1 parent
1c00920
commit 4ddc8af
Showing
7 changed files
with
572 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
defmodule Trento.SoftwareUpdates.Discovery.DiscoveryResult do | ||
@moduledoc """ | ||
This is the schema used to store the results of the software updates discovery process. | ||
""" | ||
|
||
use Ecto.Schema | ||
import Ecto.Changeset | ||
|
||
@primary_key {:host_id, :binary_id, autogenerate: false} | ||
schema "software_updates_discovery_result" do | ||
field :system_id, :string | ||
field :relevant_patches, Trento.Support.Ecto.Payload | ||
field :upgradable_packages, Trento.Support.Ecto.Payload | ||
field :failure_reason, :string | ||
|
||
timestamps(type: :utc_datetime_usec) | ||
end | ||
|
||
def changeset(discovery_result, attrs) do | ||
cast(discovery_result, attrs, __MODULE__.__schema__(:fields)) | ||
end | ||
end |
15 changes: 15 additions & 0 deletions
15
priv/repo/migrations/20240422105737_create_software_updates_discovery_result.exs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
defmodule Trento.Repo.Migrations.CreateSoftwareUpdatesDiscoveryResult do | ||
use Ecto.Migration | ||
|
||
def change do | ||
create table(:software_updates_discovery_result, primary_key: false) do | ||
add :host_id, :uuid, primary_key: true | ||
add :system_id, :string | ||
add :relevant_patches, :map | ||
add :upgradable_packages, :map | ||
add :failure_reason, :string | ||
|
||
timestamps(type: :utc_datetime_usec) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.