-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle saptune payload #1801
Handle saptune payload #1801
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @CDimonaco ,
Seeing the code, my major concern is this "transformation" of the payload in the policy. Not that it is done there. How it is done.
You are combining the updating the incoming message data.
Wouldn't be cleaner to get the data from the message and create a new map from scratch;
For example
%{packaget_version: package_version} = result = Map.get(payload, "result")
{}
|> Map.put("package_version", package_version)
|> Map.put("services", build_saptune_service(result)
|> Map.put("enabled_solutions", build_saptune_enabled_solutions(result)
...
Maybe it is a bit more verbose, but it you totally build the payload, without depending that much in the incoming data. In the current way it is really attached
deftype do | ||
field :package_version, :string | ||
field :configured_version, :string | ||
field :tuning_state, :string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be an enum as we only have 3 options: compliant
, not compliant
and no tuning
..
(yes, with spaces, we could change that as well to use snake_case I guess)
lib/trento/application/integration/discovery/payloads/saptune_discovery_payload.ex
Outdated
Show resolved
Hide resolved
lib/trento/application/integration/discovery/payloads/saptune_discovery_payload.ex
Outdated
Show resolved
Hide resolved
lib/trento/application/integration/discovery/payloads/saptune_discovery_payload.ex
Show resolved
Hide resolved
lib/trento/application/integration/discovery/payloads/test_data.text
Outdated
Show resolved
Hide resolved
lib/trento/application/integration/discovery/policies/host_policy.ex
Outdated
Show resolved
Hide resolved
lib/trento/application/integration/discovery/policies/host_policy.ex
Outdated
Show resolved
Hide resolved
lib/trento/application/integration/discovery/policies/host_policy.ex
Outdated
Show resolved
Hide resolved
7d3e8bb
to
ee4e4bd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @CDimonaco,
The code looks good in general.
I dropped some comments.
Besides that, can we add moduledocs
to all the files?
I guess once we have tests we will see if all the code is correct
lib/trento/application/integration/discovery/payloads/saptune_discovery_payload.ex
Outdated
Show resolved
Hide resolved
lib/trento/application/integration/discovery/policies/host_policy.ex
Outdated
Show resolved
Hide resolved
deftype do | ||
field :enabled, :boolean | ||
field :notes, {:array, :string} | ||
field :solutions_ids, {:array, :string} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would call this solutions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idk solutions in other value object refer to the whole solution object, I prefer to stick to ids, to just not confuse the stuff 👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, but you have notes
above, which is a list of note ids as well...
so we follow the same rule in both entries I guess
lib/trento/application/integration/discovery/policies/host_policy.ex
Outdated
Show resolved
Hide resolved
lib/trento/application/integration/discovery/policies/host_policy.ex
Outdated
Show resolved
Hide resolved
f0d6884
to
9525e82
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @CDimonaco , @EMaksy
All looking great.
Once we have the services
entry sorted out we can merge
deftype do | ||
field :enabled, :boolean | ||
field :notes, {:array, :string} | ||
field :solutions_ids, {:array, :string} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, but you have notes
above, which is a list of note ids as well...
so we follow the same rule in both entries I guess
}), | ||
do: %{"id" => solution_id, "notes" => note_list, "partial" => partially_applied} | ||
|
||
defp format_saptune_staging_informations(%{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not simply format_saptune_staging
?
In any case the final informations
with a plural s
looks wrong
lib/trento/application/integration/discovery/policies/host_policy.ex
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Green light from my side!
Once the needed module docs are there, we can merge
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@EMaksy Some suggestions on the moduledocs
9c2af10
to
14ece18
Compare
a1727c2
to
74724dc
Compare
Description
Handle Saptune payload in Host Policy.
How was this tested?
Automated tests