File tree Expand file tree Collapse file tree 16 files changed +18
-18
lines changed
tedge_operation_converter
c8y_remote_access_plugin/src Expand file tree Collapse file tree 16 files changed +18
-18
lines changed Original file line number Diff line number Diff line change @@ -14,13 +14,13 @@ pub use tedge_config_macros::all_or_nothing;
14
14
pub use tedge_config_macros:: OptionalConfig ;
15
15
16
16
impl TEdgeConfig {
17
- pub fn new ( config_location : TEdgeConfigLocation ) -> Result < Self , TEdgeConfigError > {
17
+ pub fn try_new ( config_location : TEdgeConfigLocation ) -> Result < Self , TEdgeConfigError > {
18
18
config_location. load ( )
19
19
}
20
20
21
21
pub fn load ( config_dir : & Path ) -> Result < TEdgeConfig , TEdgeConfigError > {
22
22
let config_location = TEdgeConfigLocation :: from_custom_root ( config_dir) ;
23
- TEdgeConfig :: new ( config_location)
23
+ TEdgeConfig :: try_new ( config_location)
24
24
}
25
25
26
26
#[ cfg( feature = "test" ) ]
Original file line number Diff line number Diff line change @@ -147,7 +147,7 @@ impl ExternalPlugins {
147
147
self . plugin_map . clear ( ) ;
148
148
149
149
let config =
150
- tedge_config:: TEdgeConfig :: new ( self . config_location . clone ( ) ) . map_err ( |err| {
150
+ tedge_config:: TEdgeConfig :: try_new ( self . config_location . clone ( ) ) . map_err ( |err| {
151
151
io:: Error :: new (
152
152
ErrorKind :: Other ,
153
153
format ! ( "Failed to load tedge config: {}" , err) ,
Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ mod tests {
59
59
let tmpfile = make_config ( 100 ) ?;
60
60
let config_location =
61
61
TEdgeConfigLocation :: from_custom_root ( tmpfile. path ( ) . to_str ( ) . unwrap ( ) ) ;
62
- let config = tedge_config:: TEdgeConfig :: new ( config_location) ?;
62
+ let config = tedge_config:: TEdgeConfig :: try_new ( config_location) ?;
63
63
64
64
let plugin = ExternalPluginCommand :: new (
65
65
"test" ,
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ impl UploadCertCmd {
51
51
Err ( _) => rpassword:: read_password_from_tty ( Some ( "Enter password: " ) ) ?,
52
52
} ;
53
53
54
- let config = TEdgeConfig :: new ( TEdgeConfigLocation :: default ( ) ) ?;
54
+ let config = TEdgeConfig :: try_new ( TEdgeConfigLocation :: default ( ) ) ?;
55
55
let root_cert = & config. c8y . root_cert_path ;
56
56
let client_builder = reqwest:: blocking:: Client :: builder ( ) ;
57
57
let res = match std:: fs:: metadata ( root_cert) {
Original file line number Diff line number Diff line change @@ -159,6 +159,6 @@ impl BuildContext {
159
159
}
160
160
161
161
pub fn load_config ( & self ) -> Result < tedge_config:: TEdgeConfig , tedge_config:: TEdgeConfigError > {
162
- tedge_config:: TEdgeConfig :: new ( self . config_location . clone ( ) )
162
+ tedge_config:: TEdgeConfig :: try_new ( self . config_location . clone ( ) )
163
163
}
164
164
}
Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ impl AgentConfig {
90
90
tedge_config_location : & tedge_config:: TEdgeConfigLocation ,
91
91
cliopts : AgentOpt ,
92
92
) -> Result < Self , anyhow:: Error > {
93
- let tedge_config = tedge_config:: TEdgeConfig :: new ( tedge_config_location. clone ( ) ) ?;
93
+ let tedge_config = tedge_config:: TEdgeConfig :: try_new ( tedge_config_location. clone ( ) ) ?;
94
94
95
95
let config_dir = tedge_config_location. tedge_config_root_path . clone ( ) ;
96
96
let tmp_dir = Arc :: from ( tedge_config. tmp . path . as_path ( ) ) ;
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ impl RestartManagerConfig {
14
14
device_topic_id : & EntityTopicId ,
15
15
tedge_config_location : & tedge_config:: TEdgeConfigLocation ,
16
16
) -> Result < RestartManagerConfig , tedge_config:: TEdgeConfigError > {
17
- let tedge_config = tedge_config:: TEdgeConfig :: new ( tedge_config_location. clone ( ) ) ?;
17
+ let tedge_config = tedge_config:: TEdgeConfig :: try_new ( tedge_config_location. clone ( ) ) ?;
18
18
19
19
Ok ( RestartManagerConfig {
20
20
device_topic_id : device_topic_id. clone ( ) ,
Original file line number Diff line number Diff line change @@ -325,7 +325,7 @@ impl SoftwareManagerActor {
325
325
fn get_default_plugin (
326
326
config_location : & tedge_config:: TEdgeConfigLocation ,
327
327
) -> Result < Option < SoftwareType > , TEdgeConfigError > {
328
- let tedge_config = tedge_config:: TEdgeConfig :: new ( config_location. clone ( ) ) ?;
328
+ let tedge_config = tedge_config:: TEdgeConfig :: try_new ( config_location. clone ( ) ) ?;
329
329
330
330
Ok ( tedge_config
331
331
. software
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ impl SoftwareManagerConfig {
17
17
pub fn from_tedge_config (
18
18
tedge_config_location : & TEdgeConfigLocation ,
19
19
) -> Result < SoftwareManagerConfig , tedge_config:: TEdgeConfigError > {
20
- let tedge_config = tedge_config:: TEdgeConfig :: new ( tedge_config_location. clone ( ) ) ?;
20
+ let tedge_config = tedge_config:: TEdgeConfig :: try_new ( tedge_config_location. clone ( ) ) ?;
21
21
let config_dir = & tedge_config_location. tedge_config_root_path ;
22
22
23
23
let default_plugin_type = tedge_config
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ impl OperationConfig {
16
16
device_topic_id : & EntityTopicId ,
17
17
tedge_config_location : & tedge_config:: TEdgeConfigLocation ,
18
18
) -> Result < OperationConfig , tedge_config:: TEdgeConfigError > {
19
- let tedge_config = tedge_config:: TEdgeConfig :: new ( tedge_config_location. clone ( ) ) ?;
19
+ let tedge_config = tedge_config:: TEdgeConfig :: try_new ( tedge_config_location. clone ( ) ) ?;
20
20
21
21
Ok ( OperationConfig {
22
22
mqtt_schema : MqttSchema :: with_root ( tedge_config. mqtt . topic_root . clone ( ) ) ,
You can’t perform that action at this time.
0 commit comments