-
Notifications
You must be signed in to change notification settings - Fork 54
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
fix: Include software plugin output in workflow log #2895
fix: Include software plugin output in workflow log #2895
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files
|
Robot Results
|
@@ -149,7 +149,10 @@ async fn default_plugin_config() { | |||
read_to_string(tempdir.path().join("tedge-log-plugin.toml")).unwrap(); | |||
let plugin_config_toml: Table = from_str(&plugin_config_content).unwrap(); | |||
|
|||
let agent_logs_path = format!("{}/agent/software-*", tempdir.path().to_string_lossy()); | |||
let agent_logs_path = format!( | |||
"{}/agent/workflow-software_*", |
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.
In an offline discussion with @reubenmiller, we agreed to keep this breaking change in the target file path and stop logging to the former location.
On a related note, we were wondering if we could drop the workflow-
prefix from all the log files, since we we're not writing any other kind of log file into this directory anymore. But, this is to be discussed and done in a different PR.
5f76e27
to
4c49128
Compare
self.log_command_and_output("", result).await | ||
} | ||
|
||
pub async fn log_command_and_output( |
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 function is the only new addition. Rest was just moved.
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.
Approved with a suggestion for the dependency issue on nix
.
As a personal point of view, I see the produced log file a bit more difficult to read.
In the following excerpt, one has to understand that there are 3 levels of execution
- The software_update operation is running the executing step.
- This triggers
/usr/bin/sudo "/etc/tedge/sm-plugins/apt" "prepare"
- In turn, this triggers
apt-get" "--quiet" "--yes" "update
----------------------[ software_update @ executing | time=2024-05-31T14:56:07.268064944Z ]----------------------
State: {"logPath":"/var/log/tedge/agent/workflow-software_update-c8y-mapper-44202.log","status":"executing","updateList":[{"modules":[{"action":"install","name":"rolldice","version":"::apt"}],"type":"
apt"}]}
Action: builtin
----- $ /usr/bin/sudo "/etc/tedge/sm-plugins/apt" "prepare"
Exit status: 0 (OK)
stderr (EMPTY)
stdout <<EOF
Executing command: "apt-get" "--quiet" "--yes" "update"
Hit:1 http://fr.archive.ubuntu.com/ubuntu jammy InRelease
Get:2 http://fr.archive.ubuntu.com/ubuntu jammy-updates InRelease [128 kB]
Get:3 https://packages.microsoft.com/repos/ms-teams stable InRelease [5 931 B]
async fn prepare(&self, logger: &mut BufWriter<File>) -> Result<(), SoftwareError>; | ||
async fn prepare(&self, command_log: Option<&mut CommandLog>) -> Result<(), SoftwareError>; |
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.
What's the motivation for making optional all the command loggers?
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.
To cover the case where the logPath
is not provided in the payload of the command (since it is optional) when an external component has overridden the workflows, but still using the builtin
actions for the actual installation.
I now understand that it is not easy for simple overrides of the workflow to remove an existing field from the payload, as the workflow system only appends/updates the values to the existing payload. But I'm not fully sure if it is completely impossible to guarantee that the logPath
would always be there, as long as the tedge-agent
at least initiates the workflow execution.
At least to reduce one level of information overload, I could get rid of those Instead, does grouping the output of the 3-subcommands: @reubenmiller Any suggestions?
|
fb963e1
to
a507d7a
Compare
Proposed changes
software-management
log type intedge-log-plugin.toml
to point to the workflow logsHandle this log type path change during upgrade: Won't doTypes of changes
Paste Link to the issue
#2835
Checklist
cargo fmt
as mentioned in CODING_GUIDELINEScargo clippy
as mentioned in CODING_GUIDELINESFurther comments