-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Builtin iterate action for device profile operation
- Loading branch information
1 parent
fb9847e
commit df1f7cf
Showing
18 changed files
with
876 additions
and
247 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use camino::Utf8PathBuf; | ||
use tedge_utils::file::create_file_with_defaults; | ||
use tedge_utils::file::FileError; | ||
|
||
pub struct DeviceProfileManagerBuilder {} | ||
|
||
impl DeviceProfileManagerBuilder { | ||
pub fn try_new(ops_dir: &Utf8PathBuf) -> Result<Self, FileError> { | ||
let workflow_file = ops_dir.join("device_profile.toml"); | ||
if !workflow_file.exists() { | ||
let workflow_definition = include_str!("../resources/device_profile.toml"); | ||
|
||
create_file_with_defaults(workflow_file, Some(workflow_definition))?; | ||
} | ||
Ok(Self {}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
operation = "device_profile" | ||
|
||
[init] | ||
action = "proceed" | ||
on_success = "scheduled" | ||
|
||
[scheduled] | ||
action = "proceed" | ||
on_success = "executing" | ||
|
||
[executing] | ||
action = "proceed" | ||
on_success = "next_operation" | ||
|
||
[next_operation] | ||
iterate = "${.payload.operations}" | ||
on_next = "apply_operation" | ||
on_success = "successful" | ||
on_error = "rollback" | ||
|
||
[apply_operation] | ||
operation = "${.payload.@next.item.operation}" | ||
input = "${.payload.@next.item.payload}" | ||
on_exec = "awaiting_operation" | ||
|
||
[awaiting_operation] | ||
action = "await-operation-completion" | ||
on_success = "next_operation" | ||
on_error = "rollback" | ||
|
||
[rollback] | ||
action="proceed" | ||
on_success = { status = "failed", reason = "Device profile application failed" } | ||
on_error = { status = "failed", reason = "Rollback failed" } | ||
|
||
[successful] | ||
action = "cleanup" | ||
|
||
[failed] | ||
action = "cleanup" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.