From 962f7c877b9218543a63cccab0cbb5eb1a3fe658 Mon Sep 17 00:00:00 2001 From: brl Date: Thu, 25 Jun 2015 15:11:12 -0400 Subject: [PATCH] clean command no longer needed --- oz-daemon/client.go | 23 ----------------------- oz-daemon/daemon.go | 23 ----------------------- oz-daemon/protocol.go | 6 ------ oz/main.go | 15 --------------- 4 files changed, 67 deletions(-) diff --git a/oz-daemon/client.go b/oz-daemon/client.go index 01676f0..5265f25 100644 --- a/oz-daemon/client.go +++ b/oz-daemon/client.go @@ -83,29 +83,6 @@ func Launch(arg, cpath string, args, env []string, noexec bool) error { return nil } -func Clean(arg string) error { - idx, name, err := parseProfileArg(arg) - if err != nil { - return err - } - resp, err := clientSend(&CleanMsg{ - Index: idx, - Name: name, - }) - if err != nil { - return err - } - // TODO collapse this logic into a function like clientSend - switch body := resp.Body.(type) { - case *ErrorMsg: - return errors.New(body.Msg) - case *OkMsg: - return nil - default: - return fmt.Errorf("Unexpected message received %+v", body) - } -} - func KillAllSandboxes() error { return KillSandbox(-1) } diff --git a/oz-daemon/daemon.go b/oz-daemon/daemon.go index 95264c9..5cb87b9 100644 --- a/oz-daemon/daemon.go +++ b/oz-daemon/daemon.go @@ -36,7 +36,6 @@ func Main() { d.handleListProfiles, d.handleLaunch, d.handleListSandboxes, - d.handleClean, d.handleKillSandbox, d.handleLogs, ) @@ -284,28 +283,6 @@ func (d *daemonState) handleListSandboxes(list *ListSandboxesMsg, msg *ipc.Messa return msg.Respond(r) } -func (d *daemonState) handleClean(clean *CleanMsg, msg *ipc.Message) error { - p, err := d.getProfileByIdxOrName(clean.Index, clean.Name) - if err != nil { - return msg.Respond(&ErrorMsg{err.Error()}) - } - for _, sb := range d.sandboxes { - if sb.profile.Name == p.Name { - errmsg := fmt.Sprintf("Cannot clean profile '%s' because there are sandboxes running for this profile", p.Name) - return msg.Respond(&ErrorMsg{errmsg}) - } - } - // XXX - d.Warning("Clean no longer implemented") - /* - fs := fs.NewFromProfile(p, nil, d.config.SandboxPath, d.config.UseFullDev, d.log) - if err := fs.Cleanup(); err != nil { - return msg.Respond(&ErrorMsg{err.Error()}) - } - */ - return msg.Respond(&OkMsg{}) -} - func (d *daemonState) handleLogs(logs *LogsMsg, msg *ipc.Message) error { for n := d.memBackend.Head(); n != nil; n = n.Next() { s := n.Record.Formatted(0) diff --git a/oz-daemon/protocol.go b/oz-daemon/protocol.go index b713128..eb99075 100644 --- a/oz-daemon/protocol.go +++ b/oz-daemon/protocol.go @@ -58,11 +58,6 @@ type KillSandboxMsg struct { Id int "KillSandbox" } -type CleanMsg struct { - Index int "Clean" - Name string -} - type LogsMsg struct { Count int "Logs" Follow bool @@ -82,7 +77,6 @@ var messageFactory = ipc.NewMsgFactory( new(ListSandboxesMsg), new(ListSandboxesResp), new(KillSandboxMsg), - new(CleanMsg), new(LogsMsg), new(LogData), ) diff --git a/oz/main.go b/oz/main.go index 9a6738e..4e6b472 100644 --- a/oz/main.go +++ b/oz/main.go @@ -91,10 +91,6 @@ func runApplication() { Usage: "start a shell in a running sandbox", Action: handleShell, }, - { - Name: "clean", - Action: handleClean, - }, { Name: "kill", Action: handleKill, @@ -201,17 +197,6 @@ func getSandboxById(id int) (*daemon.SandboxInfo, error) { return nil, nil } -func handleClean(c *cli.Context) { - if len(c.Args()) == 0 { - fmt.Println("Need a profile to clean") - os.Exit(1) - } - err := daemon.Clean(c.Args()[0]) - if err != nil { - fmt.Println("Clean failed:", err) - } -} - func handleKill(c *cli.Context) { if len(c.Args()) == 0 { fmt.Errorf("Need a sandbox id to kill\n")