allow missing properties field

This commit is contained in:
Keagan McClelland
2021-09-11 18:36:20 -06:00
committed by Aiden McClelland
parent 19d1e905a2
commit d157b7871b
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)
.await?
.to_owned();
manifest
.properties
.execute::<(), Value>(
&ctx,
&manifest.id,
&manifest.version,
None,
&manifest.volumes,
None,
false,
)
.await?
.map_err(|_| Error::new(anyhow!("Properties failure!"), crate::ErrorKind::Docker))
.and_then(|a| Ok(a))
if let Some(props) = manifest.properties {
props
.execute::<(), Value>(
&ctx,
&manifest.id,
&manifest.version,
None,
&manifest.volumes,
None,
false,
)
.await?
.map_err(|_| Error::new(anyhow!("Properties failure!"), crate::ErrorKind::Docker))
.and_then(|a| Ok(a))
} else {
Ok(Value::Null)
}
}