pub struct CommandSpec {
pub program: String,
pub args: Vec<String>,
pub env: BTreeMap<String, String>,
pub clear_env: bool,
pub cwd: Option<PathBuf>,
pub purpose: String,
pub stage: Option<ProvisionStage>,
pub parallel_group: Option<u32>,
pub creates_target: bool,
pub ssh_destination: Option<String>,
pub ssh_session: Option<SshTarget>,
pub ssh_session_probe: bool,
/* private fields */
}Fields§
§program: String§args: Vec<String>§env: BTreeMap<String, String>§clear_env: boolReplace ambient process variables with the explicitly supplied environment.
cwd: Option<PathBuf>§purpose: String§stage: Option<ProvisionStage>§parallel_group: Option<u32>Commands that share this marker and appear consecutively in a plan’s
command list may run concurrently under
CommandPlan::execute_concurrent. Commands without a marker, or
whose neighbors do not share it, keep running strictly in plan order.
creates_target: boolWhether this command brings the session’s target into existence. Every command after it in a provisioning plan runs against a target that already exists, so a later failure owes that target’s teardown.
ssh_destination: Option<String>The SSH destination this command opens a connection to, when it does.
Tagged commands pass through SshAdmission so the daemon never
exceeds the remote sshd’s MaxStartups budget, and a transport
rejection is retried rather than reported as a command failure.
ssh_session: Option<SshTarget>The shared SSH connection this command runs on as one session, when it
does. Just before spawning, the executor leases a session on one of the
connection’s masters with SshSessions::lease and puts the options
that bind the command to that master in front of its arguments (see
CommandSpec::open_ssh_session). The arguments stored here never
contain them.
ssh_session_probe: boolThe session is a fail-fast probe: it is counted on a shard but never
opens a master (see CommandSpec::ssh_probe_session).
Implementations§
Source§impl CommandSpec
impl CommandSpec
pub fn new( program: impl Into<String>, args: impl IntoIterator<Item = impl Into<String>>, ) -> CommandSpec
pub fn purpose(self, purpose: impl Into<String>) -> CommandSpec
pub fn stage(self, stage: ProvisionStage) -> CommandSpec
Sourcepub fn parallel_group(self, group: u32) -> CommandSpec
pub fn parallel_group(self, group: u32) -> CommandSpec
Mark this command as eligible to run concurrently with its plan-adjacent siblings that share the same group.
Sourcepub fn ssh_destination(self, destination: impl Into<String>) -> CommandSpec
pub fn ssh_destination(self, destination: impl Into<String>) -> CommandSpec
Record that this command opens an ssh connection to destination,
which is the host (or user@host) argument, never an option value.
Sourcepub fn ssh_session(self, ssh: &SshTarget) -> CommandSpec
pub fn ssh_session(self, ssh: &SshTarget) -> CommandSpec
Record that this command is an ssh or scp invocation that runs as
one session on ssh’s shared connection. It also opens a connection
to that destination, for admission, when sharing is off.
Sourcepub fn ssh_probe_session(self, ssh: &SshTarget) -> CommandSpec
pub fn ssh_probe_session(self, ssh: &SshTarget) -> CommandSpec
Record that this command is a fail-fast ssh probe, such as a target
validation, that joins ssh’s shared connection without ever opening
a master. Its short timeouts and keepalives belong to the probe alone:
a master opened by it would impose them on every later session. The
probe still uses one of the master’s sessions while it runs, so the
executor counts it in the session ledger like any other session.
Sourcepub fn open_ssh_session(
&self,
executor: &dyn CommandExecutor,
) -> Result<SessionCommand<'_>, Error>
pub fn open_ssh_session( &self, executor: &dyn CommandExecutor, ) -> Result<SessionCommand<'_>, Error>
Lease the SSH session this command asks for and return the command as it must be spawned, with the lease that must outlive the child.
A command without a session request is returned unchanged. executor
runs the master check and, when needed, the opener.
Sourcepub fn creates_target(self) -> CommandSpec
pub fn creates_target(self) -> CommandSpec
Mark this command as the one that creates the session’s target.
Sourcepub fn with_sensitive_stdin(self, input: Vec<u8>) -> CommandSpec
pub fn with_sensitive_stdin(self, input: Vec<u8>) -> CommandSpec
Feed private file content through the shared concurrent pipe handler. The bytes stay out of argv, environments, serialization, and Debug.
Trait Implementations§
Source§impl Clone for CommandSpec
impl Clone for CommandSpec
Source§fn clone(&self) -> CommandSpec
fn clone(&self) -> CommandSpec
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CommandSpec
impl Debug for CommandSpec
Source§impl<'de> Deserialize<'de> for CommandSpec
impl<'de> Deserialize<'de> for CommandSpec
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<CommandSpec, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<CommandSpec, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for CommandSpec
Source§impl PartialEq for CommandSpec
impl PartialEq for CommandSpec
Source§impl Serialize for CommandSpec
impl Serialize for CommandSpec
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for CommandSpec
Auto Trait Implementations§
impl Freeze for CommandSpec
impl RefUnwindSafe for CommandSpec
impl Send for CommandSpec
impl Sync for CommandSpec
impl Unpin for CommandSpec
impl UnsafeUnpin for CommandSpec
impl UnwindSafe for CommandSpec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more