mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 12:11:56 +00:00
appmgr: actions override entrypoint
This commit is contained in:
committed by
Aiden McClelland
parent
c0f5f09767
commit
3e3097945f
@@ -8,6 +8,7 @@ use yajrc::RpcError;
|
||||
use crate::apps::DockerStatus;
|
||||
|
||||
pub const STATUS_NOT_ALLOWED: i32 = -2;
|
||||
pub const INVALID_COMMAND: i32 = -3;
|
||||
|
||||
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize)]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
@@ -67,6 +68,11 @@ impl Action {
|
||||
cmd
|
||||
} else {
|
||||
let mut cmd = tokio::process::Command::new("docker");
|
||||
let entrypoint = self.command.get(0).ok_or_else(|| RpcError {
|
||||
code: INVALID_COMMAND,
|
||||
message: "Command Cannot Be Empty".to_owned(),
|
||||
data: None,
|
||||
})?;
|
||||
cmd.arg("run")
|
||||
.arg("--rm")
|
||||
.arg("--name")
|
||||
@@ -78,8 +84,10 @@ impl Action {
|
||||
app_id,
|
||||
man.mount.display()
|
||||
))
|
||||
.arg("--entrypoint")
|
||||
.arg(entrypoint)
|
||||
.arg(format!("start9/{}", app_id))
|
||||
.args(&self.command);
|
||||
.args(&self.command[1..]);
|
||||
// TODO: 0.3.0: net, tor, shm
|
||||
cmd
|
||||
};
|
||||
|
||||
@@ -217,6 +217,13 @@ pub async fn verify(path: &str) -> Result<(), failure::Error> {
|
||||
if let Some(shared) = &manifest.shared {
|
||||
validate_path(shared)?;
|
||||
}
|
||||
for action in &manifest.actions {
|
||||
ensure!(
|
||||
!action.command.is_empty(),
|
||||
"Command Cannot Be Empty: {}",
|
||||
action.id
|
||||
);
|
||||
}
|
||||
log::info!("Opening config spec from archive.");
|
||||
let config_spec = entries
|
||||
.next()
|
||||
|
||||
Reference in New Issue
Block a user