summaryrefslogtreecommitdiff
path: root/vendor/github.com/opencontainers/runtime-tools/specerror
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2018-06-26 13:50:12 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2018-06-27 15:16:02 +0000
commitf6c0fc1aa854ae5ce73d57ecb09d47c0d4dd2cc3 (patch)
tree55a2c6e560625df8b8e176e4ac9cb2214480d3ab /vendor/github.com/opencontainers/runtime-tools/specerror
parent19f5a504ffb1470991f331db412be456e41caab5 (diff)
downloadpodman-f6c0fc1aa854ae5ce73d57ecb09d47c0d4dd2cc3.tar.gz
podman-f6c0fc1aa854ae5ce73d57ecb09d47c0d4dd2cc3.tar.bz2
podman-f6c0fc1aa854ae5ce73d57ecb09d47c0d4dd2cc3.zip
Vendor in latest runtime-tools
Newer runtime tools separates syscalls by OS so we can build darwin. Signed-off-by: baude <bbaude@redhat.com> Closes: #1007 Approved by: baude
Diffstat (limited to 'vendor/github.com/opencontainers/runtime-tools/specerror')
-rw-r--r--vendor/github.com/opencontainers/runtime-tools/specerror/config.go6
-rw-r--r--vendor/github.com/opencontainers/runtime-tools/specerror/error.go37
-rw-r--r--vendor/github.com/opencontainers/runtime-tools/specerror/runtime.go12
3 files changed, 39 insertions, 16 deletions
diff --git a/vendor/github.com/opencontainers/runtime-tools/specerror/config.go b/vendor/github.com/opencontainers/runtime-tools/specerror/config.go
index 8a73f47fc..5357ab59f 100644
--- a/vendor/github.com/opencontainers/runtime-tools/specerror/config.go
+++ b/vendor/github.com/opencontainers/runtime-tools/specerror/config.go
@@ -14,8 +14,8 @@ const (
RootOnWindowsRequired
// RootOnHyperVNotSet represents "For Hyper-V Containers, this field MUST NOT be set."
RootOnHyperVNotSet
- // RootOnNonHyperVRequired represents "On all other platforms, this field is REQUIRED."
- RootOnNonHyperVRequired
+ // RootOnNonWindowsRequired represents "On all other platforms, this field is REQUIRED."
+ RootOnNonWindowsRequired
// RootPathOnWindowsGUID represents "On Windows, `path` MUST be a volume GUID path."
RootPathOnWindowsGUID
// RootPathOnPosixConvention represents "The value SHOULD be the conventional `rootfs`."
@@ -145,7 +145,7 @@ func init() {
register(SpecVersionInSemVer, rfc2119.Must, specificationVersionRef)
register(RootOnWindowsRequired, rfc2119.Required, rootRef)
register(RootOnHyperVNotSet, rfc2119.Must, rootRef)
- register(RootOnNonHyperVRequired, rfc2119.Required, rootRef)
+ register(RootOnNonWindowsRequired, rfc2119.Required, rootRef)
register(RootPathOnWindowsGUID, rfc2119.Must, rootRef)
register(RootPathOnPosixConvention, rfc2119.Should, rootRef)
register(RootPathExist, rfc2119.Must, rootRef)
diff --git a/vendor/github.com/opencontainers/runtime-tools/specerror/error.go b/vendor/github.com/opencontainers/runtime-tools/specerror/error.go
index 0300f7df2..5de9492d9 100644
--- a/vendor/github.com/opencontainers/runtime-tools/specerror/error.go
+++ b/vendor/github.com/opencontainers/runtime-tools/specerror/error.go
@@ -61,6 +61,34 @@ func (err *Error) Error() string {
return err.Err.Error()
}
+// NewRFCError creates an rfc2119.Error referencing a spec violation.
+//
+// A version string (for the version of the spec that was violated)
+// must be set to get a working URL.
+func NewRFCError(code Code, err error, version string) (*rfc2119.Error, error) {
+ template := ociErrors[code]
+ reference, err2 := template.Reference(version)
+ if err2 != nil {
+ return nil, err2
+ }
+ return &rfc2119.Error{
+ Level: template.Level,
+ Reference: reference,
+ Err: err,
+ }, nil
+}
+
+// NewRFCErrorOrPanic creates an rfc2119.Error referencing a spec
+// violation and panics on failure. This is handy for situations
+// where you can't be bothered to check NewRFCError for failure.
+func NewRFCErrorOrPanic(code Code, err error, version string) *rfc2119.Error {
+ rfcError, err2 := NewRFCError(code, err, version)
+ if err2 != nil {
+ panic(err2.Error())
+ }
+ return rfcError
+}
+
// NewError creates an Error referencing a spec violation. The error
// can be cast to an *Error for extracting structured information
// about the level of the violation and a reference to the violated
@@ -69,17 +97,12 @@ func (err *Error) Error() string {
// A version string (for the version of the spec that was violated)
// must be set to get a working URL.
func NewError(code Code, err error, version string) error {
- template := ociErrors[code]
- reference, err2 := template.Reference(version)
+ rfcError, err2 := NewRFCError(code, err, version)
if err2 != nil {
return err2
}
return &Error{
- Err: rfc2119.Error{
- Level: template.Level,
- Reference: reference,
- Err: err,
- },
+ Err: *rfcError,
Code: code,
}
}
diff --git a/vendor/github.com/opencontainers/runtime-tools/specerror/runtime.go b/vendor/github.com/opencontainers/runtime-tools/specerror/runtime.go
index 0144f6696..383aea63c 100644
--- a/vendor/github.com/opencontainers/runtime-tools/specerror/runtime.go
+++ b/vendor/github.com/opencontainers/runtime-tools/specerror/runtime.go
@@ -68,10 +68,10 @@ const (
PropApplyFailNotCreate
// StartWithoutIDGenError represents "`start` operation MUST generate an error if it is not provided the container ID."
StartWithoutIDGenError
- // StartNonCreateHaveNoEffect represents "Attempting to `start` a container that is not `created` MUST have no effect on the container."
- StartNonCreateHaveNoEffect
- // StartNonCreateGenError represents "Attempting to `start` a container that is not `created` MUST generate an error."
- StartNonCreateGenError
+ // StartNotCreatedHaveNoEffect represents "Attempting to `start` a container that is not `created` MUST have no effect on the container."
+ StartNotCreatedHaveNoEffect
+ // StartNotCreatedGenError represents "Attempting to `start` a container that is not `created` MUST generate an error."
+ StartNotCreatedGenError
// StartProcImplement represents "`start` operation MUST run the user-specified program as specified by `process`."
StartProcImplement
// StartWithProcUnsetGenError represents "`start` operation MUST generate an error if `process` was not set."
@@ -163,8 +163,8 @@ func init() {
register(PropApplyFailGenError, rfc2119.Must, createRef)
register(PropApplyFailNotCreate, rfc2119.Must, createRef)
register(StartWithoutIDGenError, rfc2119.Must, startRef)
- register(StartNonCreateHaveNoEffect, rfc2119.Must, startRef)
- register(StartNonCreateGenError, rfc2119.Must, startRef)
+ register(StartNotCreatedHaveNoEffect, rfc2119.Must, startRef)
+ register(StartNotCreatedGenError, rfc2119.Must, startRef)
register(StartProcImplement, rfc2119.Must, startRef)
register(StartWithProcUnsetGenError, rfc2119.Must, startRef)
register(KillWithoutIDGenError, rfc2119.Must, killRef)