Skip to content

Commit

Permalink
Merge pull request #3209 from didier-wenzek/fix/agent-skip-processing…
Browse files Browse the repository at this point in the history
…-ill-formed-software-updates

fix: agent stops processing ill-formed software_update command payloads
  • Loading branch information
didier-wenzek authored Oct 28, 2024
2 parents 365c254 + 42d5b43 commit 6145601
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 0 additions & 3 deletions crates/core/tedge_api/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,6 @@ impl CommandPayload for SoftwareListCommandPayload {
/// Sub list of modules grouped by plugin type.
#[derive(Debug, Clone, Deserialize, Eq, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
#[serde(deny_unknown_fields)]
pub struct SoftwareList {
#[serde(rename = "type")]
pub plugin_type: SoftwareType,
Expand Down Expand Up @@ -551,7 +550,6 @@ impl SoftwareUpdateCommand {
/// Sub list of modules grouped by plugin type.
#[derive(Debug, Clone, Deserialize, Eq, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
#[serde(deny_unknown_fields)]
pub struct SoftwareRequestResponseSoftwareList {
#[serde(rename = "type")]
pub plugin_type: SoftwareType,
Expand All @@ -571,7 +569,6 @@ pub enum SoftwareModuleAction {
/// Software module payload definition.
#[derive(Debug, Clone, Deserialize, Eq, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
#[serde(deny_unknown_fields)]
pub struct SoftwareModuleItem {
pub name: SoftwareName,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,16 @@ Operation gets updated regardless of the order of the creation time
... tedge mqtt pub -r te/device/main///cmd/software_update/c8y-mapper-${op_id1} '{"status":"successful","updateList":[{"type":"default","modules":[{"name":"non-existent-package1","action":"install"}]}]}'
Operation Should Be SUCCESSFUL ${OPERATION1} timeout=60

Agent should ignore unknown software-update fields
# Issue https://github.com/thin-edge/thin-edge.io/issues/3136
# Add the softwareType field erroneously to an item in the modules array
Execute Command
... tedge mqtt pub -r te/device/main///cmd/software_update/test-3136 '{"status":"init","updateList":[{"type":"apt","modules":[{"name":"jq","action":"install","version":"latest","softwareType":"invalid"}]}]}'
Should Have MQTT Messages
... te/device/main///cmd/software_update/test-3136
... message_pattern=.*"status":"successful".*
... timeout=60


*** Keywords ***
Custom Setup
Expand Down

0 comments on commit 6145601

Please sign in to comment.