Skip to content

Adapt factory-reset result parsing to the omnect-os-init JSON contract #205

Description

@JanZachmann

omnect-os-init writes the factory-reset result into /run/omnect-device-service/omnect-os-initramfs.json. The current parser in src/twin/factory_reset.rs cannot read that format.

Mismatches

omnect-os-init writes ODS expects
JSON key "factory_reset" "factory-reset"
status 0..=4 (adds 4 = Warning, see omnect/omnect-os-init#19) Deserialize_repr enum with 0..=3 only — 4 fails to parse
error omitted on success (skip_serializing_if) required String
paths omitted when empty required Vec<String>
data_wiped always present (bool) not in the struct (ignored by serde, ok)

Effect

  • Today: the key lookup omnect_os_initramfs_json["factory-reset"] returns null, so ODS logs "no result" and reports nothing. The reset outcome never reaches the twin. No error is raised.
  • After fixing only the key: a result with status: 4 or a missing error/paths makes factory_reset_result() fail. FactoryReset::new()? propagates the error out of Twin::new, so ODS does not start.

Task

Adapt FactoryResetResult/FactoryResetStatus (and the testfiles) to the omnect-os-init contract:

  • key factory_reset
  • status value 4 (warning: reset succeeded, but a partition needed a second mkfs)
  • error, paths, context optional with defaults
  • decide how to handle a future unknown status value without failing ODS startup

Contract source: src/runtime/omnect_device_service.rs in omnect/omnect-os-init and its integration tests (tests/factory_reset.rs).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions