summaryrefslogtreecommitdiff
path: root/client
diff options
authorSamuele Pedroni <pedronis@lucediurna.net>2016-08-30 17:50:23 +0200
committerSamuele Pedroni <pedronis@lucediurna.net>2016-08-30 20:54:29 +0200
commit1b84b90acb5cb9340da374075bef987a07fe47c9 (patch)
tree33951ab2211f29af44adec2fc3f80625e0e8180d /client
parent534a5c96c8b2c5245b4e72a8a84cc9ee35e3ed21 (diff)
support force-dangerous in client and cmd/snap
Diffstat (limited to 'client')
-rw-r--r--client/snap_op.go10
-rw-r--r--client/snap_op_test.go1
2 files changed, 7 insertions, 4 deletions
diff --git a/client/snap_op.go b/client/snap_op.go
index dcb5f3782f..8b8402b965 100644
--- a/client/snap_op.go
+++ b/client/snap_op.go
@@ -31,10 +31,11 @@ import (
)
type SnapOptions struct {
- Channel string `json:"channel,omitempty"`
- Revision string `json:"revision,omitempty"`
- DevMode bool `json:"devmode,omitempty"`
- JailMode bool `json:"jailmode,omitempty"`
+ Channel string `json:"channel,omitempty"`
+ Revision string `json:"revision,omitempty"`
+ DevMode bool `json:"devmode,omitempty"`
+ JailMode bool `json:"jailmode,omitempty"`
+ ForceDangerous bool `json:"force-dangerous,omitempty"`
}
type actionData struct {
@@ -180,6 +181,7 @@ func sendSnapFile(snapPath string, snapFile *os.File, pw *io.PipeWriter, mw *mul
mw.WriteField("channel", action.Channel),
mw.WriteField("devmode", strconv.FormatBool(action.DevMode)),
mw.WriteField("jailmode", strconv.FormatBool(action.JailMode)),
+ mw.WriteField("force-dangerous", strconv.FormatBool(action.ForceDangerous)),
}
for _, err := range errs {
if err != nil {
diff --git a/client/snap_op_test.go b/client/snap_op_test.go
index 3e90367b84..9cb71a7c68 100644
--- a/client/snap_op_test.go
+++ b/client/snap_op_test.go
@@ -190,6 +190,7 @@ func (cs *clientSuite) TestClientOpInstallPath(c *check.C) {
c.Assert(string(body), check.Matches, "(?s).*\r\nsnap-data\r\n.*")
c.Assert(string(body), check.Matches, "(?s).*Content-Disposition: form-data; name=\"action\"\r\n\r\ninstall\r\n.*")
+ c.Assert(string(body), check.Matches, "(?s).*Content-Disposition: form-data; name=\"force-dangerous\"\r\n\r\nfalse\r\n.*")
c.Check(cs.req.Method, check.Equals, "POST")
c.Check(cs.req.URL.Path, check.Equals, fmt.Sprintf("/v2/snaps"))