allow missing properties field

This commit is contained in:
Keagan McClelland
2021-09-11 18:36:20 -06:00
parent dcec8df20d
commit 2f07d59e1f
2 changed files with 18 additions and 15 deletions

View File

@@ -29,18 +29,21 @@ pub async fn fetch_properties(ctx: RpcContext, id: PackageId) -> Result<Value, E
.get(&mut db, true) .get(&mut db, true)
.await? .await?
.to_owned(); .to_owned();
manifest if let Some(props) = manifest.properties {
.properties props
.execute::<(), Value>( .execute::<(), Value>(
&ctx, &ctx,
&manifest.id, &manifest.id,
&manifest.version, &manifest.version,
None, None,
&manifest.volumes, &manifest.volumes,
None, None,
false, false,
) )
.await? .await?
.map_err(|_| Error::new(anyhow!("Properties failure!"), crate::ErrorKind::Docker)) .map_err(|_| Error::new(anyhow!("Properties failure!"), crate::ErrorKind::Docker))
.and_then(|a| Ok(a)) .and_then(|a| Ok(a))
} else {
Ok(Value::Null)
}
} }

View File

@@ -118,7 +118,7 @@ pub struct Manifest {
#[model] #[model]
pub config: Option<ConfigActions>, pub config: Option<ConfigActions>,
#[model] #[model]
pub properties: ActionImplementation, pub properties: Option<ActionImplementation>,
#[model] #[model]
pub volumes: Volumes, pub volumes: Volumes,
// #[serde(default = "current_version")] // #[serde(default = "current_version")]