/
rpc_proxy.go
executable file
·45 lines (38 loc) · 1.04 KB
/
rpc_proxy.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// THIS FILE IS AUTO-GENERATED DO NOT EDIT
package deluge
import (
log "github.com/Sirupsen/logrus"
"github.com/bytesizedhosting/bcd/jobs"
"github.com/bytesizedhosting/bcd/plugins"
)
type DelugeRPC struct {
base *Deluge
plugins.BaseRPC
}
func (self *DelugeRPC) Reinstall(opts *DelugeOpts, job *jobs.Job) error {
err := self.base.Uninstall(&plugins.AppConfig{ContainerId: opts.ContainerId})
if err != nil {
log.Infoln("Could not remove Docker container but since this is a reinstall we don't care.")
}
self.Install(opts, job)
return nil
}
func (self *DelugeRPC) Install(opts *DelugeOpts, job *jobs.Job) error {
*job = *jobs.New(opts)
log.Debugln("Deluge options:", opts)
go func() {
err := self.base.Install(opts)
job.Options = *opts
if err != nil {
log.Debugln("Deluge installation received an error:", err)
job.ErrorString = err.Error()
job.Error = err
job.Status = jobs.FAILED
} else {
log.Infoln("Deluge installation completed")
job.Status = jobs.FINISHED
}
jobs.Storage.Set(job.Id, job)
}()
return nil
}