clean command no longer needed

master
brl 10 years ago
parent b9aba84682
commit 962f7c877b

@ -83,29 +83,6 @@ func Launch(arg, cpath string, args, env []string, noexec bool) error {
return nil 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 { func KillAllSandboxes() error {
return KillSandbox(-1) return KillSandbox(-1)
} }

@ -36,7 +36,6 @@ func Main() {
d.handleListProfiles, d.handleListProfiles,
d.handleLaunch, d.handleLaunch,
d.handleListSandboxes, d.handleListSandboxes,
d.handleClean,
d.handleKillSandbox, d.handleKillSandbox,
d.handleLogs, d.handleLogs,
) )
@ -284,28 +283,6 @@ func (d *daemonState) handleListSandboxes(list *ListSandboxesMsg, msg *ipc.Messa
return msg.Respond(r) 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 { func (d *daemonState) handleLogs(logs *LogsMsg, msg *ipc.Message) error {
for n := d.memBackend.Head(); n != nil; n = n.Next() { for n := d.memBackend.Head(); n != nil; n = n.Next() {
s := n.Record.Formatted(0) s := n.Record.Formatted(0)

@ -58,11 +58,6 @@ type KillSandboxMsg struct {
Id int "KillSandbox" Id int "KillSandbox"
} }
type CleanMsg struct {
Index int "Clean"
Name string
}
type LogsMsg struct { type LogsMsg struct {
Count int "Logs" Count int "Logs"
Follow bool Follow bool
@ -82,7 +77,6 @@ var messageFactory = ipc.NewMsgFactory(
new(ListSandboxesMsg), new(ListSandboxesMsg),
new(ListSandboxesResp), new(ListSandboxesResp),
new(KillSandboxMsg), new(KillSandboxMsg),
new(CleanMsg),
new(LogsMsg), new(LogsMsg),
new(LogData), new(LogData),
) )

@ -91,10 +91,6 @@ func runApplication() {
Usage: "start a shell in a running sandbox", Usage: "start a shell in a running sandbox",
Action: handleShell, Action: handleShell,
}, },
{
Name: "clean",
Action: handleClean,
},
{ {
Name: "kill", Name: "kill",
Action: handleKill, Action: handleKill,
@ -201,17 +197,6 @@ func getSandboxById(id int) (*daemon.SandboxInfo, error) {
return nil, nil 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) { func handleKill(c *cli.Context) {
if len(c.Args()) == 0 { if len(c.Args()) == 0 {
fmt.Errorf("Need a sandbox id to kill\n") fmt.Errorf("Need a sandbox id to kill\n")

Loading…
Cancel
Save