Skip to main content

NormalizeError

Enum NormalizeError 

Source
#[non_exhaustive]
pub enum NormalizeError {
Show 27 variants MissingName, InvalidName(String), InvalidEnvironment { name: String, value: 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, }, SecretInLogPath { name: String, field: &'static str, }, 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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

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.

§

InvalidEnvironment

environment is crate::secrets::ALL_ENVIRONMENTS, the secrets store’s every-environment slot, or falls outside the grammar crate::secrets keys and environment names share. Carries the sheep name and the value as written.

Fields

§name: String

The sheep name, so the error names which Flockfile entry to edit.

§value: String

The value as the user wrote it.

§

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.

Fields

§name: String

The sheep name

§var: &'static str

The variable the app tried to set

§

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.

Fields

§name: String

The sheep name

§var: String

The variable the app asked for

§

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.

Fields

§pattern: String

The pattern as the user wrote it

§reason: String

Why it was rejected

§

InvalidTimezone

cron_timezone is not a name in the IANA time-zone database

Fields

§name: String

The value as the user wrote it

§

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: String

ProbeTarget::parse’s rendered rejection reason.

§

ZeroFailureThreshold

A readiness_probe or liveness_probe has failure_threshold == 0.

Fields

§probe: &'static str

"readiness_probe" or "liveness_probe", so the error names the line the user has to edit.

§

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: UpDuration

The value as the user wrote it.

§min: UpDuration

The 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.

Fields

§name: String

The sheep name, so the error names which Flockfile entry to edit.

§

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.

Fields

§name: String

The sheep name, so the error names which Flockfile entry to edit.

§value: UpDuration

The value as the user wrote it.

§max: UpDuration

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

§name: String

The sheep name, so the error names which Flockfile entry to edit.

§value: String

The value as the user wrote it.

§

WatchWithoutCwd

watch is enabled but the app sets no cwd, so there is no directory to watch. Carries the app name.

Fields

§name: String

The sheep name, so the error names which Flockfile entry to edit.

§

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

§name: String

The sheep name, so the error names which Flockfile entry to edit.

§field: &'static str

Which field carried it.

§value: String

The path as written.

§

NoHomeForTilde

A path begins ~/ and no home directory could be determined.

Fields

§name: String

The sheep name, so the error names which Flockfile entry to edit.

§field: &'static str

Which field carried it.

§

ZeroWatchDelay

watch_delay is 0, which would spin the debouncer’s own OS thread. Carries the app name.

Fields

§name: String

The sheep name, so the error names which Flockfile entry to edit.

§

InvalidWatchGlob

A watch_options or ignore_watch pattern is one globset will not compile, so the watch it describes could never be armed.

Fields

§name: String

The sheep name, so the error names which Flockfile entry to edit.

§field: &'static str

"watch_options" or "ignore_watch", so the error names which of the two lists to edit.

§pattern: String

The pattern as the user wrote it.

§reason: String

globset’s own rendered reason.

§

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

§name: String

The sheep name

§field: String

Which field, for example env.WORKER or args[1]

§reason: String

The template grammar’s own error, rendered, so this variant does not have to restate the grammar’s own copy

§

SecretInLogPath

An explicit out_file or err_file carries a {{secret:...}}.

A resolved log path is not contained the way a resolved env value is: it reaches ProcessInfo, every bus event carrying one, shep flock, shep describe, shep lookout, and a filename on disk under $SHEP_HOME/logs. {{instance}} and {{name}} still render there; only a secret is refused.

Fields

§name: String

The sheep name

§field: &'static str

out_file or err_file

§

SharedLogPath

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.

Fields

§name: String

The sheep name

§field: &'static str

out_file or err_file

§

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.

Fields

§sheep: String

The sheep whose list holds the entry

§target: String

The entry as written

Trait Implementations§

Source§

impl Clone for NormalizeError

Source§

fn clone(&self) -> NormalizeError

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for NormalizeError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for NormalizeError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for NormalizeError

Source§

impl Error for NormalizeError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl PartialEq for NormalizeError

Source§

fn eq(&self, other: &NormalizeError) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for NormalizeError

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.