Commit Graph

10 Commits

Author SHA1 Message Date
Brian Goff ebcb7d6b40 Remove string checking in API error handling
Use strongly typed errors to set HTTP status codes.
Error interfaces are defined in the api/errors package and errors
returned from controllers are checked against these interfaces.

Errors can be wraeped in a pkg/errors.Causer, as long as somewhere in the
line of causes one of the interfaces is implemented. The special error
interfaces take precedence over Causer, meaning if both Causer and one
of the new error interfaces are implemented, the Causer is not
traversed.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2017-08-15 16:01:11 -04:00
Derek McGowan 1009e6a40b
Update logrus to v1.0.1
Fixes case sensitivity issue

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-07-31 13:16:46 -07:00
Aaron Lehmann 1128fc1add Store container names in memdb
Currently, names are maintained by a separate system called "registrar".
This means there is no way to atomically snapshot the state of
containers and the names associated with them.

We can add this atomicity and simplify the code by storing name
associations in the memdb. This removes the need for pkg/registrar, and
makes snapshots a lot less expensive because they no longer need to copy
all the names. This change also avoids some problematic behavior from
pkg/registrar where it returns slices which may be modified later on.

Note that while this change makes the *snapshotting* atomic, it doesn't
yet do anything to make sure containers are named at the same time that
they are added to the database. We can do that by adding a transactional
interface, either as a followup, or as part of this PR.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-07-13 12:35:00 -07:00
Fabio Kung 03aa24721c no need to save state to disk here
State will be saved on the following operation once the container is
properly registered on the daemon.

Signed-off-by: Fabio Kung <fabio.kung@gmail.com>
2017-06-23 07:52:32 -07:00
Jorge Marin 2bee1cfd5a Use quoted form of container name and container id
Use quoted form of container name and container id to improve copy-paste avoiding the extra `.` that slips into the clipboard

Signed-off-by: Jorge Marin <chipironcin@users.noreply.github.com>
2017-01-17 08:26:05 +00:00
Vincent Demeester dba271a42a
Move names to package api
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-12-21 22:42:47 +01:00
Yong Tang c90ec05175 Restrict checkpoint name to prevent directory traversal
This fix tries to address the issue raised in 28769 where
checkpoint name was not checked before passing to containerd.
As a result, it was possible to use a special checkpoint name
to get outside of the container's directory.

This fix add restriction `[a-zA-Z0-9][a-zA-Z0-9_.-]+` (`RestrictedNamePattern`).
This is the same as container name restriction.

This fix fixes 28769.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-11-23 13:23:07 -08:00
David Trott c9d0a77657 Added the word "container" to clarify the error message.
Signed-off-by: David Trott <github@davidtrott.com>
2016-08-22 13:41:17 -07:00
Vincent Demeester bfa0885c37
Moving some more methods away from daemon.go
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-05-27 11:32:26 +02:00
Vincent Demeester fb48bf518b
Move some container related methods and structs to smaller files
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-05-24 21:31:15 +02:00