Several exported symbols describe a contract Compose never honors, and a
reader of the package cannot tell: the stack status constants (Stack.Status is
never one of them), ConfigOptions and ServiceStatus (no operation takes or
returns them), the error sentinels ErrAlreadyExists, ErrForbidden, ErrUnknown
and ErrUnsupportedFlag (never returned, with their Is helpers), and the
ExitCodeLoginRequired exit code of the cloud login Compose no longer has.
Mark them Deprecated, with no change of behavior, so that they can be
removed with the next breaking release. Nothing in the repository uses them.
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
Exec, port, export, commit and attach fail with "service X is not running"
when they find no container to act on. A program driving Compose as a library
could only recognise that failure by matching the message.
Return a ServiceNotRunningError, which matches the new ErrNotRunning and
carries the service and the replica index. The message is unchanged.
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
CreateOptions.Recreate and RecreateDependencies are strings, and any value
other than force or never silently behaved like diverged: a typo such as
"forced" was accepted and did the opposite of what the caller meant.
Add CreateOptions.Validate, which rejects such values with an
InvalidOptionError matching the new ErrInvalidOption, and call it from
Create and, through UpOptions.Validate, from Up, before anything is
touched. The empty string keeps meaning diverged, and the Recreate*
constants are unchanged, so existing callers are not affected.
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
The CLI refuses combinations such as --wait with --attach, or --detach with
--abort-on-container-exit, --exit-code-from or --watch. The library did not:
an integrator setting Start.Wait together with Start.Attach got an
interactive session in which the wait was silently dropped, and the
session-only options were silently ignored when Attach is nil.
Add UpOptions.Validate, called first thing by Up, which returns an
*IncompatibleOptionsError matching api.ErrIncompatibleOptions. The CLI is
unchanged.
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>