summaryrefslogtreecommitdiff
path: root/pkg/api
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-02-21 07:33:22 -0500
committerGitHub <noreply@github.com>2020-02-21 07:33:22 -0500
commitaae8874204ace4b15cd2bc84cfd05d3e1a70da52 (patch)
tree0029b9ca12bfd0f18850ff0b29907256caa21bb0 /pkg/api
parentbfeaabb35054119bc2ce93f09a2e3aeee43cc6df (diff)
parent3aa32dff1d27f81cab9bfcf97e431e3c2e5e37f5 (diff)
downloadpodman-aae8874204ace4b15cd2bc84cfd05d3e1a70da52.tar.gz
podman-aae8874204ace4b15cd2bc84cfd05d3e1a70da52.tar.bz2
podman-aae8874204ace4b15cd2bc84cfd05d3e1a70da52.zip
Merge pull request #5262 from schubter/signal-decode
APIv2: Fixed syscall.Signal not convertable by decoder
Diffstat (limited to 'pkg/api')
-rw-r--r--pkg/api/handlers/decoder.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/pkg/api/handlers/decoder.go b/pkg/api/handlers/decoder.go
index 890d77ecc..03b86275d 100644
--- a/pkg/api/handlers/decoder.go
+++ b/pkg/api/handlers/decoder.go
@@ -3,8 +3,10 @@ package handlers
import (
"encoding/json"
"reflect"
+ "syscall"
"time"
+ "github.com/containers/libpod/pkg/util"
"github.com/gorilla/schema"
"github.com/sirupsen/logrus"
)
@@ -17,6 +19,9 @@ func NewAPIDecoder() *schema.Decoder {
d.IgnoreUnknownKeys(true)
d.RegisterConverter(map[string][]string{}, convertUrlValuesString)
d.RegisterConverter(time.Time{}, convertTimeString)
+
+ var Signal syscall.Signal
+ d.RegisterConverter(Signal, convertSignal)
return d
}
@@ -89,3 +94,11 @@ func convertTimeString(query string) reflect.Value {
func ParseDateTime(query string) time.Time {
return convertTimeString(query).Interface().(time.Time)
}
+
+func convertSignal(query string) reflect.Value {
+ signal, err := util.ParseSignal(query)
+ if err != nil {
+ logrus.Infof("convertSignal: Failed to parse %s: %s", query, err.Error())
+ }
+ return reflect.ValueOf(signal)
+}