#[non_exhaustive]pub enum NormalizeError {
Show 25 variants
MissingName,
InvalidName(String),
ReservedEnvVar {
name: String,
var: &'static str,
},
IncrementVarRemoved {
name: String,
var: String,
},
MissingScript,
ZeroInstances,
InvalidCron {
pattern: String,
reason: String,
},
InvalidTimezone {
name: String,
},
DuplicateName(String),
DependencyCycle(Vec<String>),
InvalidProbe {
probe: &'static str,
reason: String,
},
ZeroFailureThreshold {
probe: &'static str,
},
IntervalBelowMinimum {
probe: &'static str,
value: UpDuration,
min: UpDuration,
},
ZeroMaxMemory {
name: String,
},
ActionTimeoutTooLong {
name: String,
value: UpDuration,
max: UpDuration,
},
InvalidKillSignal {
name: String,
value: String,
},
WatchWithoutCwd {
name: String,
},
TildeUser {
name: String,
field: &'static str,
value: String,
},
NoHomeForTilde {
name: String,
field: &'static str,
},
ZeroWatchDelay {
name: String,
},
InvalidWatchGlob {
name: String,
field: &'static str,
pattern: String,
reason: String,
},
BadTemplate {
name: String,
field: String,
reason: String,
},
SharedLogPath {
name: String,
field: &'static str,
},
SelfDependency(String),
InstanceDependency {
sheep: String,
target: String,
},
}Expand description
Error type returned from normalize and normalize_all
#[non_exhaustive]: every config surface this crate learns to validate
brings its own rejection reasons with it.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
MissingName
name is empty
InvalidName(String)
name contains /, \ or :, or is ./... A path separator
would escape the shep home, since the name becomes a filesystem path
stem; a colon is the name:slot separator, and is also illegal in a
Windows filename, which a sheep name becomes part of. Carries the
name.
ReservedEnvVar
An app’s env sets a variable shep injects itself. Carries the sheep
name and the variable, so the error names the entry to edit.
IncrementVarRemoved
increment_var was removed in favour of {{instance}} templating.
Carries the variable the app named, so the error can show the exact
line to write instead.
MissingScript
script is empty
ZeroInstances
instances is zero
InvalidCron
cron_restart is not valid in croner’s dialect. Carries the pattern
and the rejection reason.
InvalidTimezone
cron_timezone is not a name in the IANA time-zone database
DuplicateName(String)
Two apps in one flock share this name
DependencyCycle(Vec<String>)
Two or more apps in one document depend on each other. Carries the cycle as a path, so the refusal names it rather than only reporting that one exists.
InvalidProbe
A readiness_probe or liveness_probe target is malformed. Carries
which probe and the rendered reason.
Fields
probe: &'static str"readiness_probe" or "liveness_probe", so the error names the
line the user has to edit.
reason: StringProbeTarget::parse’s rendered rejection reason.
ZeroFailureThreshold
A readiness_probe or liveness_probe has failure_threshold == 0.
Fields
IntervalBelowMinimum
A readiness_probe or liveness_probe has an interval under the
floor its own loop in the daemon honours. At 0 that would spin the
loop as fast as the runtime allows; a liveness_probe under a full
second would instead be silently polled at that second.
Fields
probe: &'static str"readiness_probe" or "liveness_probe", so the error names the
line the user has to edit.
value: UpDurationThe value as the user wrote it.
min: UpDurationThe floor it failed.
ZeroMaxMemory
max_memory is 0, a ceiling every live process is already over, so
the enforcer would restart the sheep on every poll forever. Carries
the app name.
ActionTimeoutTooLong
action_timeout is at or above normalize’s own ceiling: a wait no
RPC caller could ever be given enough deadline to outlast, since the
daemon clamps every deadline a caller can ask for. Carries the app
name, the value as written, and the ceiling it failed.
InvalidKillSignal
kill_signal names a signal the daemon’s stop ladder cannot send.
Carries the app name and the value as written.
Fields
WatchWithoutCwd
watch is enabled but the app sets no cwd, so there is no
directory to watch. Carries the app name.
TildeUser
A path begins ~user/, naming another user’s home.
Refused rather than resolved: answering it means a passwd lookup, and
under a systemd unit the answer is not obviously the one anyone meant.
~/ is supported; this is not.
Fields
NoHomeForTilde
A path begins ~/ and no home directory could be determined.
Fields
ZeroWatchDelay
watch_delay is 0, which would spin the debouncer’s own OS thread.
Carries the app name.
InvalidWatchGlob
A watch_options or ignore_watch pattern is one globset will not
compile, so the watch it describes could never be armed.
Fields
BadTemplate
A value carries a {{...}} that is not a template token, or a {{
it never closes. Carries the sheep name, which field held it, and the
rejection rendered.
Fields
An explicit log path renders to the same string for two different
slots, the app runs more than one instance, and merge_logs is off,
so every instance would write to one file without having asked to.
A path with no {{instance}} is the ordinary case; a {{name}}-only
path and an escaped {{{{instance}}}} collide for the same reason.
SelfDependency(String)
An app names itself in depends_on. Carries the sheep name. A
one-node cycle, caught here rather than in the graph because it is
visible in a single AppConfig.
InstanceDependency
A depends_on entry names one instance rather than an app. Carries
the sheep and the offending target, so the refusal can name both.
Trait Implementations§
Source§impl Clone for NormalizeError
impl Clone for NormalizeError
Source§fn clone(&self) -> NormalizeError
fn clone(&self) -> NormalizeError
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 NormalizeError
impl Debug for NormalizeError
Source§impl Display for NormalizeError
impl Display for NormalizeError
impl Eq for NormalizeError
Source§impl Error for NormalizeError
impl Error for NormalizeError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl PartialEq for NormalizeError
impl PartialEq for NormalizeError
impl StructuralPartialEq for NormalizeError
Auto Trait Implementations§
impl Freeze for NormalizeError
impl RefUnwindSafe for NormalizeError
impl Send for NormalizeError
impl Sync for NormalizeError
impl Unpin for NormalizeError
impl UnsafeUnpin for NormalizeError
impl UnwindSafe for NormalizeError
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.