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

Update progenitor from v0.4.0 -> v0.5.0 #4874

Merged
merged 3 commits into from
Jan 25, 2024
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
152 changes: 76 additions & 76 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions clients/dns-service-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ pub fn is_retryable(error: &DnsConfigError<crate::types::Error>) -> bool {
let response_value = match error {
DnsConfigError::CommunicationError(_) => return true,
DnsConfigError::InvalidRequest(_)
| DnsConfigError::InvalidResponsePayload(_)
| DnsConfigError::UnexpectedResponse(_) => return false,
| DnsConfigError::InvalidResponsePayload(_, _)
| DnsConfigError::UnexpectedResponse(_)
| DnsConfigError::InvalidUpgrade(_)
| DnsConfigError::ResponseBodyError(_) => return false,
DnsConfigError::ErrorResponse(response_value) => response_value,
};

Expand Down
49 changes: 12 additions & 37 deletions common/src/api/external/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -487,20 +487,19 @@ pub trait ClientError: std::fmt::Debug {
impl<T: ClientError> From<progenitor::progenitor_client::Error<T>> for Error {
fn from(e: progenitor::progenitor_client::Error<T>) -> Self {
match e {
// This error indicates that the inputs were not valid for this API
// call. It's reflective of either a client-side programming error.
progenitor::progenitor_client::Error::InvalidRequest(msg) => {
Error::internal_error(&format!("InvalidRequest: {}", msg))
// For most error variants, we delegate to the display impl for the
// Progenitor error type, but we pick apart an error response more
// carefully.
progenitor::progenitor_client::Error::InvalidRequest(_)
| progenitor::progenitor_client::Error::CommunicationError(_)
| progenitor::progenitor_client::Error::InvalidResponsePayload(
..,
)
| progenitor::progenitor_client::Error::UnexpectedResponse(_)
| progenitor::progenitor_client::Error::InvalidUpgrade(_)
| progenitor::progenitor_client::Error::ResponseBodyError(_) => {
Error::internal_error(&e.to_string())
}

// This error indicates a problem with the request to the remote
// service that did not result in an HTTP response code, but rather
// pertained to local (i.e. client-side) encoding or network
// communication.
progenitor::progenitor_client::Error::CommunicationError(ee) => {
Error::internal_error(&format!("CommunicationError: {}", ee))
}

// This error represents an expected error from the remote service.
progenitor::progenitor_client::Error::ErrorResponse(rv) => {
let message = rv.message();
Expand All @@ -515,30 +514,6 @@ impl<T: ClientError> From<progenitor::progenitor_client::Error<T>> for Error {
_ => Error::internal_error(&message),
}
}

// This error indicates that the body returned by the client didn't
// match what was documented in the OpenAPI description for the
// service. This could only happen for us in the case of a severe
// logic/encoding bug in the remote service or due to a failure of
// our version constraints (i.e. that the call was to a newer
// service with an incompatible response).
progenitor::progenitor_client::Error::InvalidResponsePayload(
ee,
) => Error::internal_error(&format!(
"InvalidResponsePayload: {}",
ee,
)),

// This error indicates that the client generated a response code
// that was not described in the OpenAPI description for the
// service; this could be a success or failure response, but either
// way it indicates a logic or version error as above.
progenitor::progenitor_client::Error::UnexpectedResponse(r) => {
Error::internal_error(&format!(
"UnexpectedResponse: status code {}",
r.status(),
))
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion nexus/src/app/sagas/switch_port_settings_apply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ async fn spa_undo_ensure_switch_port_settings(
let log = sagactx.user_data().log();

let port_id: PortId = PortId::from_str(&params.switch_port_name)
.map_err(|e| external::Error::internal_error(e))?;
.map_err(|e| external::Error::internal_error(e.to_string().as_str()))?;
bnaecker marked this conversation as resolved.
Show resolved Hide resolved

let orig_port_settings_id = sagactx
.lookup::<Option<Uuid>>("original_switch_port_settings_id")
Expand Down
2 changes: 1 addition & 1 deletion nexus/src/app/sagas/switch_port_settings_clear.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ async fn spa_undo_clear_switch_port_settings(
let log = sagactx.user_data().log();

let port_id: PortId = PortId::from_str(&params.port_name)
.map_err(|e| external::Error::internal_error(e))?;
.map_err(|e| external::Error::internal_error(e.to_string().as_str()))?;
bnaecker marked this conversation as resolved.
Show resolved Hide resolved

let orig_port_settings_id = sagactx
.lookup::<Option<Uuid>>("original_switch_port_settings_id")
Expand Down
4 changes: 3 additions & 1 deletion openapi/bootstrap-agent.json
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@
]
},
"Certificate": {
"description": "Certificate\n\n<details><summary>JSON schema</summary>\n\n```json { \"type\": \"object\", \"required\": [ \"cert\", \"key\" ], \"properties\": { \"cert\": { \"type\": \"string\" }, \"key\": { \"type\": \"string\" } } } ``` </details>",
"type": "object",
"properties": {
"cert": {
Expand Down Expand Up @@ -903,6 +904,7 @@
"format": "uuid"
},
"RecoverySiloConfig": {
"description": "RecoverySiloConfig\n\n<details><summary>JSON schema</summary>\n\n```json { \"type\": \"object\", \"required\": [ \"silo_name\", \"user_name\", \"user_password_hash\" ], \"properties\": { \"silo_name\": { \"$ref\": \"#/components/schemas/Name\" }, \"user_name\": { \"$ref\": \"#/components/schemas/UserId\" }, \"user_password_hash\": { \"$ref\": \"#/components/schemas/NewPasswordHash\" } } } ``` </details>",
"type": "object",
"properties": {
"silo_name": {
Expand Down Expand Up @@ -967,7 +969,7 @@
]
},
"UserId": {
"description": "Names must begin with a lower case ASCII letter, be composed exclusively of lowercase ASCII, uppercase ASCII, numbers, and '-', and may not end with a '-'. Names cannot be a UUID though they may contain a UUID.",
"description": "Names must begin with a lower case ASCII letter, be composed exclusively of lowercase ASCII, uppercase ASCII, numbers, and '-', and may not end with a '-'. Names cannot be a UUID though they may contain a UUID.\n\n<details><summary>JSON schema</summary>\n\n```json { \"title\": \"A name unique within the parent collection\", \"description\": \"Names must begin with a lower case ASCII letter, be composed exclusively of lowercase ASCII, uppercase ASCII, numbers, and '-', and may not end with a '-'. Names cannot be a UUID though they may contain a UUID.\", \"type\": \"string\", \"maxLength\": 63, \"minLength\": 1, \"pattern\": \"^(?![0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$)^[a-z]([a-zA-Z0-9-]*[a-zA-Z0-9]+)?$\" } ``` </details>",
"type": "string"
}
},
Expand Down
Loading
Loading