Skip to content

Commit 68b95a7

Browse files
Steven GradyCQ Bot
authored andcommitted
[ffx] Fixed log check in strict mode
The handling of env vars in strict mode was incorrect (even after fxr/1177196); one consequence was that the `log.enabled` compiled-in default was being ignored, resulting in no logging occurring in strict mode (which may actually be the right behavior, but it should be explicit rather than dependent on a bug). Fixed: 380520089 Change-Id: I30452890521317b14f686fa542fb311af0e3f4aa Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/1178489 Commit-Queue: Steven Grady <[email protected]> Reviewed-by: Casey Dahlin <[email protected]>
1 parent c2a9f58 commit 68b95a7

File tree

1 file changed

+12
-5
lines changed
  • src/developer/ffx/config/src/api

1 file changed

+12
-5
lines changed

src/developer/ffx/config/src/api/query.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ impl<'a> ConfigQuery<'a> {
148148
.map_err(|e| ConfigError::new(e))?
149149
.recursive_map(&|val| build(&ctx, val))
150150
.recursive_map(&|val| workspace(&ctx, val));
151-
if let Some(ref v) = cv.0 {
151+
let cv = if let Some(ref v) = cv.0 {
152152
// We want recursive mapping here, so that arrays that contain
153153
// env variables get handled correctly.
154154
let ev_res = cv.clone().recursive_map(&|val| env_var_strict(val));
@@ -163,9 +163,13 @@ impl<'a> ConfigQuery<'a> {
163163
self.name.unwrap(),
164164
)});
165165
}
166-
}
166+
ev_res
167+
} else {
168+
cv
169+
};
167170
// The problem is not with an env variable; keep going
168-
let cv = cv.recursive_map(&T::handle_arrays).recursive_map(&validate_type::<T>);
171+
let cv = cv.recursive_map(&T::handle_arrays);
172+
let cv = cv.recursive_map(&validate_type::<T>);
169173
T::try_convert(cv)
170174
} else {
171175
let cv = self
@@ -202,15 +206,18 @@ impl<'a> ConfigQuery<'a> {
202206
.map_err(|e| ConfigError::new(e))?
203207
.recursive_map(&|val| build(&ctx, val))
204208
.recursive_map(&|val| workspace(&ctx, val));
205-
if let Some(ref v) = cv.0 {
209+
let cv = if let Some(ref v) = cv.0 {
206210
let ev_res = cv.clone().recursive_map(&|val| env_var_strict(val));
207211
if ev_res.0.is_none() {
208212
return Err(ConfigError::BadValue{ value: v.clone(), reason: format!(
209213
"The value for {} contains a variable mapping, which is ignored in strict mode",
210214
self.name.unwrap(),
211215
)});
212216
}
213-
}
217+
ev_res
218+
} else {
219+
cv
220+
};
214221
// The problem is not with an env variable; keep going
215222
let cv = cv.recursive_map(&T::handle_arrays).recursive_map(&file_check);
216223
T::try_convert(cv)

0 commit comments

Comments
 (0)