summaryrefslogtreecommitdiffstats
path: root/tedge
diff options
context:
space:
mode:
authorLukasz Woznicki <75632179+makr11st@users.noreply.github.com>2021-11-17 12:48:45 +0000
committerGitHub <noreply@github.com>2021-11-17 12:48:45 +0000
commit4fcbe6590c0cbe6dfb40eb62073acc113a292657 (patch)
treeb8e1261ec059d6aaa20e8ddf088ee4ed61a748a3 /tedge
parenteb181ec177621ff54c783bcd1adaad04d1d266f6 (diff)
[CIT-678] Change error message to inform about new way to set device id (#572)
* Change error message to inform about new way to set device id. * Fix tests for tedge config Signed-off-by: Lukasz Woznicki <lukasz.woznicki@softwareag.com>
Diffstat (limited to 'tedge')
-rw-r--r--tedge/src/cli/config/commands/get.rs6
-rw-r--r--tedge/src/cli/config/commands/list.rs3
-rw-r--r--tedge/tests/main.rs16
3 files changed, 12 insertions, 13 deletions
diff --git a/tedge/src/cli/config/commands/get.rs b/tedge/src/cli/config/commands/get.rs
index 70c53553..4cb0f1cc 100644
--- a/tedge/src/cli/config/commands/get.rs
+++ b/tedge/src/cli/config/commands/get.rs
@@ -25,6 +25,12 @@ impl Command for GetConfigCommand {
self.config_key.key
);
}
+ Err(tedge_config::ConfigSettingError::SettingIsNotConfigurable { .. }) => {
+ println!(
+ "The provided config key: '{}' is not configurable",
+ self.config_key.key
+ );
+ }
Err(err) => return Err(err.into()),
}
diff --git a/tedge/src/cli/config/commands/list.rs b/tedge/src/cli/config/commands/list.rs
index 73708d41..8645e7ec 100644
--- a/tedge/src/cli/config/commands/list.rs
+++ b/tedge/src/cli/config/commands/list.rs
@@ -37,7 +37,8 @@ fn print_config_list(
Ok(value) => {
println!("{}={}", config_key.key, value);
}
- Err(tedge_config::ConfigSettingError::ConfigNotSet { .. }) => {
+ Err(tedge_config::ConfigSettingError::ConfigNotSet { .. })
+ | Err(tedge_config::ConfigSettingError::SettingIsNotConfigurable { .. }) => {
keys_without_values.push(config_key.key.into());
}
Err(err) => return Err(err.into()),
diff --git a/tedge/tests/main.rs b/tedge/tests/main.rs
index d561222e..ee1d9dcb 100644
--- a/tedge/tests/main.rs
+++ b/tedge/tests/main.rs
@@ -74,9 +74,7 @@ mod tests {
get_device_id_cmd
.assert()
.success()
- .stdout(predicate::str::contains(
- "The provided config key: 'device.id' is not set",
- ));
+ .stdout(predicate::str::contains("device.id"));
// The create command created a certificate
create_cmd.assert().success();
@@ -112,9 +110,7 @@ mod tests {
get_device_id_cmd
.assert()
.success()
- .stdout(predicate::str::contains(
- "The provided config key: 'device.id' is not set",
- ));
+ .stdout(predicate::str::contains("device.id"));
// The a new certificate can then be created.
create_cmd.assert().success();
@@ -137,9 +133,7 @@ mod tests {
get_device_id_cmd
.assert()
.success()
- .stdout(predicate::str::contains(
- "The provided config key: 'device.id' is not set",
- ));
+ .stdout(predicate::str::contains("device.id"));
// forbidden to set read-only key by CLI
let mut set_device_id_cmd = tedge_command_with_test_home(
@@ -222,9 +216,7 @@ mod tests {
get_device_id_cmd
.assert()
.success()
- .stdout(predicate::str::contains(
- "The provided config key: 'device.id' is not set",
- ));
+ .stdout(predicate::str::contains("device.id"));
let mut get_cert_path_cmd =
tedge_command_with_test_home(test_home_str, &["config", "get", "device.cert.path"])?;