Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change config::verify to warn on conflict between targetless + steal mode. #1965

Merged
merged 3 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/verify-config.changed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Change targetless + steal mode to warning instead of error.
6 changes: 4 additions & 2 deletions mirrord/config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#![warn(clippy::indexing_slicing)]
//! <!--${internal}-->
//! To generate the `mirrord-schema.json` file see
//! [`tests::check_schema_file_exists_and_is_valid_or_create_it`].

Check warning on line 7 in mirrord/config/src/lib.rs

View workflow job for this annotation

GitHub Actions / check-rust-docs

unresolved link to `tests::check_schema_file_exists_and_is_valid_or_create_it`
//!
//! Remember to re-generate the `mirrord-schema.json` if you make **ANY** changes to this lib,
//! including if you only made documentation changes.
Expand Down Expand Up @@ -301,8 +301,10 @@
}

/// Verify that there are no conflicting settings.
///
/// We don't call it from `from_env` since we want to verify it only once (from cli)
/// Returns vec of warnings
///
/// Fills `context` with the warnings.
pub fn verify(&self, context: &mut ConfigContext) -> Result<(), ConfigError> {
if self.pause {
if self.agent.ephemeral && !self.agent.privileged {
Expand Down Expand Up @@ -368,7 +370,7 @@
Err(ConfigError::TargetNamespaceWithoutTarget)?;
}
if self.feature.network.incoming.is_steal() {
Err(ConfigError::Conflict("Steal mode is not compatible with a targetless agent, please either disable this option or specify a target.".into()))?;
context.add_warning("Steal mode is not compatible with a targetless agent, please either disable this option or specify a target.".into());
}
if self.agent.ephemeral {
Err(ConfigError::Conflict(
Expand Down
Loading