config: allow spawning clients with tags
This commit is contained in:
parent
8b19315f50
commit
a1df575262
11 changed files with 80 additions and 7 deletions
|
|
@ -421,6 +421,7 @@ pub struct Exec {
|
|||
pub args: Vec<String>,
|
||||
pub envs: Vec<(String, String)>,
|
||||
pub privileged: bool,
|
||||
pub tag: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ impl Parser for ExecParser<'_> {
|
|||
args: vec![],
|
||||
envs: vec![],
|
||||
privileged: false,
|
||||
tag: None,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -70,6 +71,7 @@ impl Parser for ExecParser<'_> {
|
|||
args,
|
||||
envs: vec![],
|
||||
privileged: false,
|
||||
tag: None,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -79,12 +81,13 @@ impl Parser for ExecParser<'_> {
|
|||
table: &IndexMap<Spanned<String>, Spanned<Value>>,
|
||||
) -> ParseResult<Self> {
|
||||
let mut ext = Extractor::new(self.0, span, table);
|
||||
let (prog_opt, shell_opt, args_val, envs_val, privileged) = ext.extract((
|
||||
let (prog_opt, shell_opt, args_val, envs_val, privileged, tag) = ext.extract((
|
||||
opt(str("prog")),
|
||||
opt(str("shell")),
|
||||
opt(arr("args")),
|
||||
opt(val("env")),
|
||||
recover(opt(bol("privileged"))),
|
||||
opt(str("tag")),
|
||||
))?;
|
||||
let prog;
|
||||
let mut args = vec![];
|
||||
|
|
@ -112,11 +115,21 @@ impl Parser for ExecParser<'_> {
|
|||
None => vec![],
|
||||
Some(e) => e.parse_map(&mut EnvParser)?,
|
||||
};
|
||||
if let Some(privileged) = privileged
|
||||
&& privileged.value
|
||||
&& tag.is_some()
|
||||
{
|
||||
log::warn!(
|
||||
"Exec is privileged and tagged but tagged execs are always unprivileged: {}",
|
||||
self.0.error3(privileged.span),
|
||||
);
|
||||
}
|
||||
Ok(Exec {
|
||||
prog,
|
||||
args,
|
||||
envs,
|
||||
privileged: privileged.despan().unwrap_or(false),
|
||||
tag: tag.despan_into(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1646,6 +1646,9 @@ fn create_command(exec: &Exec) -> Command {
|
|||
if exec.privileged {
|
||||
command.privileged();
|
||||
}
|
||||
if let Some(tag) = &exec.tag {
|
||||
command.tag(tag);
|
||||
}
|
||||
command
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue