summaryrefslogtreecommitdiffstats
path: root/crates/core/tedge_agent/src/agent.rs
AgeCommit message (Collapse)Author
2022-08-18Merge pull request #1279 from matthiasbeyer/remove-let-unitDidier Wenzek
Clippy: Remove let unit
2022-08-18make log directory configurable during initinitard
* the log directory configured in tedge config set logs.path is now used in --init Signed-off-by: initard <alex.solomes@softwareag.com>
2022-08-18Fix clippy in tedge_agent: Remove let-unit-valueMatthias Beyer
This patch fixes `clippy::let_unit_value`. Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-06Do not necessarily pass &str anymore to fs helper fnsMatthias Beyer
This patch changs the calls of the fs helper functions where the interface of the functions was changed from taking `&str` as path argument to `impl AsRef<Path>`. Because of this, it is not necessary anymore that `&str` is passed, but `Path`es can be passed or, as in most cases, the ad-hoc created `String` objects can be passed by value instead of by reference, resulting in less mental load on the calling side. Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-07-29MQTT health endpoints for tedge plugin extensions (#1299)PradeepKiruvale
* tedge watchdog for c8y-log-plugin and c8y-config-plugin This PR also refactors the health check by removing the duplicate code. Pushed the duplicate code to one place and reused it across all the thin-edge services. Signed-off-by: Pradeep Kumar K J <pradeepkumar.kj@softwareag.com>
2022-06-16tedge_agent fixing clippy warnings #825initard
Signed-off-by: initard <solo@softwareag.com>
2022-06-09Testing utility: TempTedgeDir POC (#1148)Alex Solomes
* temp tedge dir poc Signed-off-by: initard <solo@softwareag.com> * renaming crate and removing TedgeChildTempDir - renamed the crate to tedge_test_utils - removed TedgeChildTempDir as TempTedgeDir already had the same functions Signed-off-by: Alex Solomes <alex.solomes@softwareag.com> * changing agent.rs tests to use TempTedgeDir - changing agent.rs to use TempTedgeDir - un-ignoring a test to check if agent restart creates a file in the right place Signed-off-by: Alex Solomes <alex.solomes@softwareag.com> * changing tedge_mapper tests to use TempTedgeDir Signed-off-by: Alex Solomes <alex.solomes@softwareag.com> * changing tedge_config tests to use TempTedgeDir Signed-off-by: Alex Solomes <alex.solomes@softwareag.com> * changing c8y_configuration_plugin tests to use TempTedgeDir Signed-off-by: Alex Solomes <alex.solomes@softwareag.com> * changing tedge_apama_plugin tests to use TempTedgeDir Signed-off-by: Alex Solomes <alex.solomes@softwareag.com> * changing logged_command tests to use TempTedgeDir Signed-off-by: Alex Solomes <alex.solomes@softwareag.com> * adding another method to TempTedgeDir Signed-off-by: initard <solo@softwareag.com> Co-authored-by: initard <solo@softwareag.com>
2022-05-27Unit test for latest health response validation logicAlbin Suresh
2022-05-27Fix watchdog health check with timestamp validationAlbin Suresh
2022-05-03operation logs improvement #1027initard
Signed-off-by: initard <solo@softwareag.com>
2022-05-03moving operation_logs out of agent #1027initard
- moved operation logs out of agent to be used in mapper Signed-off-by: initard <solo@softwareag.com>
2022-05-03operation logs type #1027initard
- changed operation logs to allow other log types not just software list and software update Signed-off-by: initard <solo@softwareag.com>
2022-04-21Have a single unix user used for all the thin-edge daemons (#1085)PradeepKiruvale
* Closes #1031 single tedge user Signed-off-by: Pradeep Kumar K J <pradeepkumar.kj@softwareag.com> * Add script to upgrade tedge from 0.6 Signed-off-by: Pradeep Kumar K J <pradeepkumar.kj@softwareag.com>
2022-04-11Remove default from some tedge config settigsRina Fujino
Signed-off-by: Rina Fujino <18257209+rina23q@users.noreply.github.com>
2022-04-11Closes #1040 use config-dir feature for initalize and run (#1059)PradeepKiruvale
2022-03-31Include PID in health status message of tedge-daemonsAlbin Suresh
2022-03-31Issue #769 Common health check MQTT endpoint for tedge daemonsAlbin Suresh
2022-03-30Merge PR #1025 MQTT health endpoints for tedge-daemonsAlbin Suresh
Closes #769 MQTT health endpoint for tedge-daemons
2022-03-30MQTT health endpoint for tedge-agentAlbin Suresh
2022-03-24[#761] tedge init (#993)PradeepKiruvale
* tedge init #Closes 761 * add file/directory creation errors * add the clear session to az and collectd mappers * refactor tedgecomponent * remove redundant code * subscribe to az/collectd topics in init_session * remove duplicate init_sessions
2022-03-15appending tedge/agent to logs.path key (#997)initard
- this was causing the software list operation to fail with permission denied Signed-off-by: initard <solo@softwareag.com>
2022-03-11error handling on tedge-agent start upinitard
Signed-off-by: initard <solo@softwareag.com> Co-authored-by: Pradeep Kumar K J <pradeepkumar.kj@sofwareag.com>
2022-03-10fixing sm plugins path error message (#937)initard
- ensuring success status is sent if no sm-plugins dir present (with empty software list) - added test confirming this Signed-off-by: initard <solo@softwareag.com>
2022-03-04configurable run path (#858)initard
- added logs.path to `tedge` command - can now use `tedge config set run.path /some/run/path` - agent and mapper use the run config Signed-off-by: initard <solo@softwareag.com>
2022-03-04configurable logs path (#858)initard
- added logs.path to `tedge` command - can now use `tedge config set logs.path /some/log/path` Signed-off-by: initard <solo@softwareag.com>
2022-03-01[823] Configurable mqtt bind address (#929)PradeepKiruvale
* [823] add mqtt.bind_address option * ipaddress instead of string
2022-02-22--config-dir for tedge command (#814)initard
When the tedge command is called, you can now pass `--config-dir` as a cli option. The default value for this option is "/etc/tedge" and is defined in tedge_config/src/tedge_config_location.rs. - removed if/else tedge_config::TEdgeConfigLocation::from_users_home_location logic from tedge main.rs - added --config-dir option to tedge command - fixed failing tests Signed-off-by: initard <solo@softwareag.com>
2022-02-15Merge pull request #879 from matthiasbeyer/clippy-fixes-tedge_agentMatthias Beyer
Clippy fixes for: tedge_agent
2022-02-14Remove needless static lifetimeMatthias Beyer
This fixes clippy lint `clippy::redundant_static_lifetimes`. Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-02-14Remove borrow that is immediately dereferencedMatthias Beyer
This fixes clippy lint `clippy::needless_borrow`. Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-02-07Replace new() constructor with Default implMatthias Beyer
This fixes clippy lint `clippy::new_without_default`. Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-02-04[699] init/clear agent and mapper sessions (#797)PradeepKiruvale
* add init to tedge_agent * init mapper * init mapper and agent postinst * separate init and clear session functions * use tokio::mutex instead of std::mutex * pysys test for agent init * system test for mapper init session * use mqtt_channel init/clear session apis Co-authored-by: Pradeep Kumar K J <pradeepkumar.kj@sofwareag.com>
2022-01-19Refactoring the MQTT client API (#575)Didier Wenzek
* Basic data types for MQTT channels * Mqtt connection * Mqtt-channel: subscribe to topics * Mqtt-channel: publish messages Signed-off-by: Wenzek <diw@softwareag.com> * Mqtt-channel: an MQTT client as no direct dependency to MQTT Signed-off-by: Wenzek <diw@softwareag.com> * Mqtt-chanels: no message lost on reconnect Signed-off-by: Wenzek <diw@softwareag.com> * Cargo fmt Signed-off-by: Wenzek <diw@softwareag.com> * Merge with child device management * Remove the dependency to the `async-broadcast` and `async-channel` crates * Moving the helper functions to the `mqtt_tests` crate * Ensure an MQTT client can be tested without an MQTT broker * Removing dependency on the mqtt_client crate * Use the new `mqtt_channel` crate in the `sm-c8y` mapper This actually fixes the bug #570 * [570] Cargo fmt * Remove the dependency of the collectd mapper on the `mqtt_client` crate Signed-off-by: Wenzek <diw@softwareag.com> * Make configurable the maximum size of a message Signed-off-by: Didier Wenzek <didier.wenzek@free.fr> * Fix typo in comment Signed-off-by: Didier Wenzek <didier.wenzek@free.fr> * Use mqtt_channel instead of mqtt_client in tedge_agent Signed-off-by: Didier Wenzek <didier.wenzek@free.fr> * Improve doc comments Signed-off-by: Didier Wenzek <didier.wenzek@free.fr> * Add error case on closed channel Signed-off-by: Didier Wenzek <didier.wenzek@free.fr> * Add PubChannel & SubChannel traits Signed-off-by: Didier Wenzek <didier.wenzek@free.fr> * Cargo fmt Signed-off-by: Didier Wenzek <didier.wenzek@free.fr> * Revert erroneously added changes Signed-off-by: Didier Wenzek <didier.wenzek@free.fr> * Add a channel for errors Signed-off-by: Didier Wenzek <didier.wenzek@free.fr> * Log MQTT connection errors Signed-off-by: Didier Wenzek <didier.wenzek@free.fr> * Fix HTTP_proxy port Signed-off-by: Didier Wenzek <didier.wenzek@free.fr> * Remove unused code Signed-off-by: Didier Wenzek <didier.wenzek@free.fr> * Improve tests Signed-off-by: Didier Wenzek <didier.wenzek@free.fr> * Move session configuration from Connection to Config * Set max_packet_size default to 1M Signed-off-by: Didier Wenzek <didier.wenzek@free.fr> * Cargo fmt Signed-off-by: Didier Wenzek <didier.wenzek@free.fr> * Fix broken tests (on missing operation directory) Signed-off-by: Didier Wenzek <didier.wenzek@free.fr> Co-authored-by: Wenzek <diw@softwareag.com> Co-authored-by: Didier Wenzek <didier.wenzek@free.fr>
2022-01-12Feature/651/configurable temp path (#732)initard
* configurable download path (WIP) (#651) Signed-off-by: initard <solo@softwareag.com> * download path test (WIP) (#651) Signed-off-by: initard <solo@softwareag.com> * default download path #651 Signed-off-by: initard <solo@softwareag.com> * install to download.path test (#651) Signed-off-by: initard <solo@softwareag.com> * formatting issues (#651) Signed-off-by: initard <solo@softwareag.com> * formatting issues (#651) Signed-off-by: initard <solo@softwareag.com> * rename download path to tmp path & test fix (#651) Signed-off-by: initard <solo@softwareag.com> * cargo fmt Signed-off-by: initard <solo@softwareag.com> * download path integration test (#651) Signed-off-by: initard <solo@softwareag.com> * adding doc detailing how to set temp path (#651) Signed-off-by: initard <solo@softwareag.com> * test fix (#651) Signed-off-by: initard <solo@softwareag.com> * adding sudo to doc (#651) Signed-off-by: initard <solo@softwareag.com> * removing unused test (#651) Signed-off-by: initard <solo@softwareag.com> * renaming, refactoring and extra documentation (#651) Signed-off-by: initard <solo@softwareag.com> * fixing naming of tmp.path (#651) Signed-off-by: initard <solo@softwareag.com> * changes to tmp dto #651 Signed-off-by: initard <solo@softwareag.com> Co-authored-by: initard <solo@softwareag.com>
2022-01-11[663] agent topics (#731)PradeepKiruvale
* move topics to json_sm crate * rename json_sm to sm_interface * format * rename agent interface * fix order of crates * rename crate * rename topics enum * refactor downloader code * move topicerror to error.rs * trigger wf * cargo fmt * address review comments * separate c8y topics * add tests * cargo fmt * change match cases * use download from common crate * update test names * fix the match issue * fix the topic matching * address review comments * remove mqtt dependancy * simplify try_from Co-authored-by: Pradeep Kumar K J <pradeepkumar.kj@sofwareag.com>
2022-01-07Remove capabilities messages on tedge agent start (#741)Didier Wenzek
Signed-off-by: Didier Wenzek <didier.wenzek@free.fr> Co-authored-by: Didier Wenzek <didier.wenzek@free.fr>
2021-12-09creating runtime directory /run/tedge_agent (#683) (#698)initard
* creating runtime directory /run/tedge_agent (#683) Signed-off-by: initard <solo@softwareag.com> * ignoring test due to permission error (#683) Signed-off-by: initard <solo@softwareag.com> Co-authored-by: initard <solo@softwareag.com>
2021-12-06Feature/599/restart device cloud operation (#662)initard
* cloud restart operation #599 Signed-off-by: initard <solo@softwareag.com> * operation set to executing c8y #599 Signed-off-by: initard <solo@softwareag.com> * cargo fmt Signed-off-by: initard <solo@softwareag.com> * removing debug hard-coded echo Signed-off-by: initard <solo@softwareag.com> * updated handle_restart_opeartion signature in test #599 Signed-off-by: initard <solo@softwareag.com> * test update for c8y_Restart Signed-off-by: initard <solo@softwareag.com> * removed panic on empty restart request #599 Signed-off-by: initard <solo@softwareag.com> Co-authored-by: initard <solo@softwareag.com>
2021-12-01[Bug-540] tedge agent missing software list request (#653)PradeepKiruvale
* test * fix the mqtt message missing issue * fix typos * rename function Co-authored-by: Pradeep Kumar K J <pradeepkumar.kj@sofwareag.com>
2021-11-26[CIT-659] restart device local operation (#591)initard
* [CIT-659] operation status rename Signed-off-by: Alex <solo@softwareag.com> * [CIT-659] OperationStatus rename Signed-off-by: Alex <solo@softwareag.com> * [CIT-659] adding new structs to lib import Signed-off-by: Alex <solo@softwareag.com> * [CIT-659] restart operation implementation Signed-off-by: Alex <solo@softwareag.com> * [CIT-659] restart operation check (WIP) Signed-off-by: Alex <solo@softwareag.com> * [CIT-659] wip Signed-off-by: Alex <solo@softwareag.com> * [CIT-659] restart operation check when /run/tedge_agent_restart persists after operation Signed-off-by: Alex <solo@softwareag.com> * [CIT-659] stash merge Signed-off-by: initard <solo@softwareag.com> * [CIT-659] restart operation refactoring, - chrono dependency Signed-off-by: initard <solo@softwareag.com> * [CIT-659] removed package feature, made file creation more explicit Signed-off-by: initard <solo@softwareag.com> * [CIT-659] dealing with some unwraps and error handling Signed-off-by: initard <solo@softwareag.com> * [CIT-659] reverting changes to operation_logs + error handling Signed-off-by: initard <solo@softwareag.com> * [CIT-659] changed operation from echo 6 to init 6 Signed-off-by: initard <solo@softwareag.com> * [CIT-659] fixing restart check logic Signed-off-by: initard <solo@softwareag.com> * [CIT-659] refactored error handling and added unit test for /run/tedge_agent_restart Signed-off-by: initard <solo@softwareag.com> * [CIT-659] refactoring of tests Signed-off-by: initard <solo@softwareag.com> * [CIT-659] ignored failed test Signed-off-by: initard <solo@softwareag.com> Co-authored-by: Alex <solo@softwareag.com>
2021-11-24Restructure directories of the workspace (#559)Lukasz Woznicki
* Restructure directories of the workspace * Rename c8y_translator_lib to c8y_translator * Update comment on how to get dummy plugin path Signed-off-by: Lukasz Woznicki <lukasz.woznicki@softwareag.com>