|
|
@ -95,6 +95,15 @@ impl Config { |
|
|
|
pub fn get_hook(&self, name: &str) -> Result<Vec<hooks::Hook>, Error> {
|
|
|
|
for hook in self.hook.iter() {
|
|
|
|
if name == hook.name {
|
|
|
|
if !hook.hook_type.contains(&HookType::PostOperation)
|
|
|
|
&& hook.run_after_failure.is_some()
|
|
|
|
{
|
|
|
|
return Err(format!(
|
|
|
|
"{}: run_after_failure can only be used with post-operation hooks", hook.name
|
|
|
|
)
|
|
|
|
.into());
|
|
|
|
}
|
|
|
|
|
|
|
|
let h = hooks::Hook {
|
|
|
|
name: hook.name.to_owned(),
|
|
|
|
hook_type: hook.hook_type.iter().map(|e| e.to_owned()).collect(),
|
|
|
@ -106,6 +115,7 @@ impl Config { |
|
|
|
allow_failure: hook
|
|
|
|
.allow_failure
|
|
|
|
.unwrap_or(crate::DEFAULT_HOOK_ALLOW_FAILURE),
|
|
|
|
run_after_failure: hook.run_after_failure.unwrap_or(true),
|
|
|
|
};
|
|
|
|
return Ok(vec![h]);
|
|
|
|
}
|
|
|
@ -326,6 +336,7 @@ pub struct Hook { |
|
|
|
pub stdout: Option<String>,
|
|
|
|
#[serde(rename = "type")]
|
|
|
|
pub hook_type: Vec<HookType>,
|
|
|
|
pub run_after_failure: Option<bool>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Clone, Debug, Eq, Hash, PartialEq, Deserialize)]
|
|
|
@ -376,7 +387,10 @@ impl ExternalAccount { |
|
|
|
| JwsSignatureAlgorithm::Hs384
|
|
|
|
| JwsSignatureAlgorithm::Hs512 => {}
|
|
|
|
_ => {
|
|
|
|
return Err(format!("{signature_algorithm}: invalid signature algorithm for external account binding").into());
|
|
|
|
return Err(format!(
|
|
|
|
"{signature_algorithm}: invalid signature algorithm for external account binding"
|
|
|
|
)
|
|
|
|
.into());
|
|
|
|
}
|
|
|
|
};
|
|
|
|
Ok(crate::account::ExternalAccount {
|
|
|
|