diff --git a/sled-agent/src/rack_setup/service.rs b/sled-agent/src/rack_setup/service.rs index 3cbc11b7e6..ff9c76a148 100644 --- a/sled-agent/src/rack_setup/service.rs +++ b/sled-agent/src/rack_setup/service.rs @@ -288,16 +288,21 @@ impl ServiceInner { }; if let sled_agent_client::Error::ErrorResponse(response) = &error { - if let Some(code) = &response.error_code { - if code == "RequestedConfigOutdated" { - // XXX-dap is this really how to do this? look at what - // nexus does when propagating DNS maybe? or maybe the - // DNS tests? - return Ok(()); - } + if response.status() == http::StatusCode::CONFLICT { + warn!( + self.log, + "ignoring attempt to initialize zones because \ + the server seems to be newer"; + "attempted_version" => i64::from(&zones_config.version), + "req_id" => &response.request_id, + "server_message" => &response.message, + ); + + return Ok(()); } } + // TODO Many other codes here should not be retried. return Err(BackoffError::transient(error)); }; let log_failure = |error, delay| { diff --git a/sled-agent/src/services.rs b/sled-agent/src/services.rs index db87ea8166..cdce151217 100644 --- a/sled-agent/src/services.rs +++ b/sled-agent/src/services.rs @@ -238,8 +238,16 @@ impl Error { impl From for omicron_common::api::external::Error { fn from(err: Error) -> Self { - omicron_common::api::external::Error::InternalError { - internal_message: err.to_string(), + match err { + err @ Error::RequestedConfigOutdated(_, _) => { + omicron_common::api::external::Error::conflict(&format!( + "{:#}", + err + )) + } + _ => omicron_common::api::external::Error::InternalError { + internal_message: err.to_string(), + }, } } }