Skip to content

Commit

Permalink
fix(deviceManageemnt): fixed required attributes for DeviceInventoryC…
Browse files Browse the repository at this point in the history
…ontainer start and stop operations

Signed-off-by: Alberto Codutti <alberto.codutti@eurotech.com>
  • Loading branch information
Coduz committed Jan 8, 2024
1 parent 586581c commit 7850bf7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,6 @@ public void execContainer(KapuaId scopeId, KapuaId deviceId, DeviceInventoryCont
ArgumentValidator.notNull(deviceInventoryContainer, "deviceInventoryContainer");
ArgumentValidator.notNull(deviceInventoryContainer.getName(), "deviceInventoryContainer.name");
ArgumentValidator.notNull(deviceInventoryContainer.getVersion(), "deviceInventoryContainer.version");
ArgumentValidator.notNull(deviceInventoryContainer.getContainerType(), "deviceInventoryContainer.type");
ArgumentValidator.notNull(deviceInventoryContainer.getState(), "deviceInventoryContainer.state");
ArgumentValidator.notNull(deviceInventoryContainerAction, "deviceInventoryContainerAction");

//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,13 @@ protected DeviceInventoryContainers translate(KuraInventoryContainers kuraInvent
deviceInventoryContainer.setVersion(kuraInventoryContainer.getVersion());
deviceInventoryContainer.setContainerType(kuraInventoryContainer.getType());

try {
deviceInventoryContainer.setState(DeviceInventoryContainerState.valueOf(kuraInventoryContainer.getState()));
} catch (IllegalArgumentException iae) {
LOG.warn("Unrecognised KuraInventoryContainer.state '{}' received. Defaulting to UNKNOWN state for DeviceInventoryContainer {}", kuraInventoryContainer.getState(), deviceInventoryContainer.getName(), iae);
deviceInventoryContainer.setState(DeviceInventoryContainerState.UNKNOWN);
if (deviceInventoryContainer.getState() != null) {
try {
deviceInventoryContainer.setState(DeviceInventoryContainerState.valueOf(kuraInventoryContainer.getState()));
} catch (IllegalArgumentException iae) {
LOG.warn("Unrecognised KuraInventoryContainer.state '{}' received. Defaulting to UNKNOWN state for DeviceInventoryContainer {}", kuraInventoryContainer.getState(), deviceInventoryContainer.getName(), iae);
deviceInventoryContainer.setState(DeviceInventoryContainerState.UNKNOWN);
}
}

deviceInventoryContainers.addInventoryContainer(deviceInventoryContainer);
Expand Down

0 comments on commit 7850bf7

Please sign in to comment.