Skip to content

Commit b2244c9

Browse files
authored
fix updating values of overridden parameters (#606)
1 parent de21798 commit b2244c9

11 files changed

Lines changed: 29 additions & 18 deletions

File tree

.github/workflows/test-production.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
releaseVersion:
99
description: CLI release version to download and install
1010
type: string
11-
default: '1.2.5'
11+
default: '1.2.6'
1212
runsOn:
1313
description: The runner to run the workflow on
1414
type: string

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# 1.2.6 - 2025-04-29
2+
* fixed bug where values of overridden parameters were not updated correctly
3+
14
# 1.2.5 - 2025-04-29
25
* fixed bug where overriding parameters would not correctly set values
36

Cargo.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "cloudtruth"
3-
version = "1.2.5"
3+
version = "1.2.6"
44
description = "A command-line interface to the CloudTruth configuration management service."
55
authors = ["CloudTruth <support@cloudtruth.com>"]
66
edition = "2021"
@@ -44,16 +44,16 @@ ca-certificates = "*"
4444

4545
[build-dependencies]
4646
clap = "2.33.3"
47-
cloudtruth-config = { path = "crates/cloudtruth-config", version = "1.2.5" }
47+
cloudtruth-config = { path = "crates/cloudtruth-config", version = "1.2.6" }
4848

4949
[dependencies]
5050
aes-gcm = "0.9.2"
5151
base64 = "0.13.0"
5252
chacha20poly1305 = "0.8.0"
5353
chrono = "0.4.23"
5454
clap = "2.33.3"
55-
cloudtruth-config = { path = "crates/cloudtruth-config", version = "1.2.5" }
56-
cloudtruth-installer = { path = "crates/cloudtruth-installer", version = "1.2.5" }
55+
cloudtruth-config = { path = "crates/cloudtruth-config", version = "1.2.6" }
56+
cloudtruth-installer = { path = "crates/cloudtruth-installer", version = "1.2.6" }
5757
cloudtruth-restapi = { path = "crates/cloudtruth-restapi" }
5858
color-eyre = "0.5"
5959
csv = "1.1.6"

crates/cloudtruth-config/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "cloudtruth-config"
3-
version = "1.2.5"
3+
version = "1.2.6"
44
edition = "2021"
55
license = "Apache-2.0"
66

crates/cloudtruth-installer/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "cloudtruth-installer"
3-
version = "1.2.5"
3+
version = "1.2.6"
44
edition = "2021"
55
license = "Apache-2.0"
66

examples/help-text/cloudtruth.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
```console
22
$ cloudtruth --help
3-
cloudtruth 1.2.5
3+
cloudtruth 1.2.6
44
CloudTruth <support@cloudtruth.com>
55
A command-line interface to the CloudTruth configuration management service.
66

src/database/parameter_details.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ pub struct ParameterDetails {
2020
// these come from the value for the specified environment
2121
pub val_id: String,
2222
pub value: String,
23+
pub val_url: String,
2324
pub env_url: String,
2425
pub env_name: String,
2526
pub external: bool,
@@ -76,6 +77,7 @@ impl ParameterDetails {
7677
pub fn set_value(&mut self, env_value: &Value) {
7778
self.val_id = env_value.id.clone();
7879
self.value = env_value.value.clone().unwrap_or_default();
80+
self.val_url = env_value.url.clone();
7981
self.env_url = env_value.environment.replace("http://", "https://");
8082
self.external = env_value.external.unwrap_or(false);
8183
self.fqn = env_value.external_fqn.clone().unwrap_or_default();
@@ -113,6 +115,7 @@ impl Default for ParameterDetails {
113115
project_name: "".to_string(),
114116
val_id: "".to_string(),
115117
value: DEFAULT_VALUE.to_string(),
118+
val_url: "".to_string(),
116119
env_url: "".to_string(),
117120
env_name: "".to_string(),
118121
external: false,
@@ -183,6 +186,7 @@ impl From<&Parameter> for ParameterDetails {
183186

184187
val_id: env_value.id.clone(),
185188
value: env_value.value.clone().unwrap_or_default(),
189+
val_url: env_value.url.clone(),
186190
env_url: env_value.environment.clone(),
187191
env_name: env_value.environment_name.clone(),
188192
external: env_value.external.unwrap_or(false),

src/parameters.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,9 +1028,13 @@ fn proc_param_set(
10281028
// don't do anything if there's nothing to do
10291029
if value_field_update {
10301030
env_changed = format!(" for environment '{}'", resolved.environment_display_name());
1031-
// if any existing environment does not match the desired environment
1032-
// or we created a new parameter to override an inherited one
1033-
if !updated.env_url.contains(env_id) || param_added {
1031+
// if we created a new parameter to override an inherited one
1032+
// or any existing environment does not match the desired environment
1033+
// or the current environment value is in a different project
1034+
if param_added
1035+
|| !updated.env_url.contains(env_id)
1036+
|| !updated.val_url.contains(updated.project_url.as_str())
1037+
{
10341038
set_action = "Set";
10351039
let value_add_result = parameters.create_parameter_value(
10361040
rest_cfg, proj_id, env_id, param_id, value, fqn, jmes_path, evaluated,

tests/harness/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "cloudtruth-test-harness"
3-
version = "1.2.5"
3+
version = "1.2.6"
44
edition = "2021"
55
license = "Apache-2.0"
66

0 commit comments

Comments
 (0)