fix(sysctl): disable setting values for deprecated variables

This commit is contained in:
Orhun Parmaksız 2021-12-15 13:05:29 +03:00
parent c98e427d2c
commit 7d3ac997d2
No known key found for this signature in database
GPG key ID: F83424824B3E4B90

View file

@ -132,7 +132,15 @@ impl<'a> App<'a> {
if let Some(new_value) = new_value {
let config = self.sysctl.config.clone();
if let Some(param) = self.sysctl.get_parameter(&parameter) {
param.update_value(&new_value, &config, &mut self.stdout)?;
if DEPRECATED_VARIABLES.contains(&param.absolute_name().unwrap_or_default()) {
eprintln!(
"{}: {} is deprecated, value not set",
env!("CARGO_PKG_NAME"),
parameter
);
} else {
param.update_value(&new_value, &config, &mut self.stdout)?;
}
}
} else if display_value {
self.sysctl