summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Mistewicz <a.mistewicz@samsung.com>2018-01-23 16:05:44 +0100
committerAleksander Mistewicz <a.mistewicz@samsung.com>2018-06-18 14:16:19 +0200
commit3303afc21a5d8a0370a65b29340b076ca01996a6 (patch)
treefecea2847556bcc5980f60b4e662ebcdaac54a32
parenta2f2f68976d10d54aac1bce12b4810f9c6f9f736 (diff)
downloadboruta-3303afc21a5d8a0370a65b29340b076ca01996a6.tar.gz
boruta-3303afc21a5d8a0370a65b29340b076ca01996a6.tar.bz2
boruta-3303afc21a5d8a0370a65b29340b076ca01996a6.zip
Add STMsocket to dryad/conf
Due to change in git.tizen.org/tools/muxpi/sw/nanopi/stm communication medium has changed. Preferably, dryad should connect to the running process of stm via unix socket exposing Go RPC interface. It is possible to use it in the old way by assigning "" to stm_socket configuration entry. Change-Id: If6f4b41c9dbf467e3d40772eb52b55cbbc79d749 Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
-rw-r--r--cmd/dryad/dryad.go16
-rw-r--r--dryad/conf/conf.go5
-rw-r--r--dryad/conf/conf_test.go4
3 files changed, 22 insertions, 3 deletions
diff --git a/cmd/dryad/dryad.go b/cmd/dryad/dryad.go
index 1e79d87..b7d637f 100644
--- a/cmd/dryad/dryad.go
+++ b/cmd/dryad/dryad.go
@@ -28,6 +28,7 @@ import (
"git.tizen.org/tools/boruta/dryad/conf"
dryad_rpc "git.tizen.org/tools/boruta/rpc/dryad"
superviser_rpc "git.tizen.org/tools/boruta/rpc/superviser"
+ "git.tizen.org/tools/muxpi/sw/nanopi/stm"
)
var (
@@ -75,7 +76,20 @@ func main() {
}
readConfFile()
- rusalka := dryad.NewRusalka(configuration.User.Name, configuration.User.Groups)
+ var dev stm.InterfaceCloser
+ if configuration.STMsocket != "" {
+ cl, err := rpc.Dial("unix", configuration.STMsocket)
+ exitOnErr("failed to connect to RPC service:", err)
+
+ dev = stm.NewInterfaceClient(cl)
+ } else {
+ var err error
+ dev, err = stm.GetDefaultSTM()
+ exitOnErr("failed to connect to STM:", err)
+ }
+ defer dev.Close()
+
+ rusalka := dryad.NewRusalka(dev, configuration.User.Name, configuration.User.Groups)
l, err := net.Listen("tcp", configuration.Address)
exitOnErr("can't listen on port:", err)
diff --git a/dryad/conf/conf.go b/dryad/conf/conf.go
index 42675ba..049fb7b 100644
--- a/dryad/conf/conf.go
+++ b/dryad/conf/conf.go
@@ -40,7 +40,8 @@ func NewConf() *General {
Name: "boruta-user",
Groups: []string{},
},
- SDcard: "/dev/sdX",
+ SDcard: "/dev/sdX",
+ STMsocket: "/run/stm.socket",
}
}
@@ -68,6 +69,8 @@ type General struct {
User *User `toml:"user"`
// SDcard is a base path to block device of sdcard.
SDcard string `toml:"sdcard"`
+ // STMsocket is a path to the socket on which Go RPC service of stm.Interface is available.
+ STMsocket string `toml:"stm_path"`
}
// Marshal writes TOML representation of g to w.
diff --git a/dryad/conf/conf_test.go b/dryad/conf/conf_test.go
index f1f7177..f8f9997 100644
--- a/dryad/conf/conf_test.go
+++ b/dryad/conf/conf_test.go
@@ -31,6 +31,7 @@ var _ = Describe("Conf", func() {
marshaled := `listen_address = ":7175"
boruta_address = ""
sdcard = "/dev/sdX"
+stm_path = "/run/stm.socket"
[caps]
@@ -45,7 +46,8 @@ sdcard = "/dev/sdX"
Name: "boruta-user",
Groups: []string{},
},
- SDcard: "/dev/sdX",
+ SDcard: "/dev/sdX",
+ STMsocket: "/run/stm.socket",
}
var g *General