summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Mistewicz <a.mistewicz@samsung.com>2017-10-12 14:54:33 +0200
committerMaciej Wereski <m.wereski@partner.samsung.com>2018-03-05 18:29:20 +0100
commit5211b87e795e8d24b86e3cb6db1839c94f947160 (patch)
tree249e9bb4790ad3706901f007d776cbeee3cd1903
parenta7b61bbdcda0de7d2b434f1834d205341c9c05ea (diff)
downloadboruta-5211b87e795e8d24b86e3cb6db1839c94f947160.tar.gz
boruta-5211b87e795e8d24b86e3cb6db1839c94f947160.tar.bz2
boruta-5211b87e795e8d24b86e3cb6db1839c94f947160.zip
Add Caps to dryad configuration
In the future Capabilities will be read from MuxPi's hardware. Currently write to and read from it is not supported therefore it has been added to configuration. Change-Id: Idedc71205bc4eea0fa489fa595daf6c367a1082c Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com> Reviewed-on: https://mcdsrvbld02.digital.local/review/49596 Reviewed-by: Maciej Wereski <m.wereski@partner.samsung.com> Tested-by: Maciej Wereski <m.wereski@partner.samsung.com>
-rw-r--r--cmd/dryad/dryad.go8
-rw-r--r--dryad/conf/conf.go8
-rw-r--r--dryad/conf/conf_test.go4
3 files changed, 20 insertions, 0 deletions
diff --git a/cmd/dryad/dryad.go b/cmd/dryad/dryad.go
index 4339a5a..1e79d87 100644
--- a/cmd/dryad/dryad.go
+++ b/cmd/dryad/dryad.go
@@ -27,6 +27,7 @@ import (
"git.tizen.org/tools/boruta/dryad"
"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"
)
var (
@@ -86,6 +87,13 @@ func main() {
go srv.Accept(l)
+ boruta, err := superviser_rpc.DialSuperviserClient(configuration.BorutaAddress)
+ exitOnErr("failed to initialize connection to boruta:", err)
+ defer boruta.Close()
+
+ err = boruta.Register(configuration.Caps)
+ exitOnErr("failed to register to boruta:", err)
+
// Wait for interrupt.
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt)
diff --git a/dryad/conf/conf.go b/dryad/conf/conf.go
index c12a226..42675ba 100644
--- a/dryad/conf/conf.go
+++ b/dryad/conf/conf.go
@@ -23,6 +23,8 @@ import (
"io/ioutil"
"github.com/BurntSushi/toml"
+
+ . "git.tizen.org/tools/boruta"
)
// DefaultRPCPort is a port that should be used as default parameter
@@ -33,6 +35,7 @@ const DefaultRPCPort = 7175
func NewConf() *General {
return &General{
Address: fmt.Sprintf(":%d", DefaultRPCPort),
+ Caps: Capabilities(map[string]string{}),
User: &User{
Name: "boruta-user",
Groups: []string{},
@@ -56,6 +59,11 @@ type General struct {
Address string `toml:"listen_address"`
// BorutaAddress is used to connect to Boruta server.
BorutaAddress string `toml:"boruta_address"`
+ // Caps are necessary information to register in Boruta.
+ //
+ // TODO(amistewicz): This field should be removed when
+ // it will be possible to read it from hardware.
+ Caps Capabilities `toml:"caps"`
// User refers information necessary to create the user.
User *User `toml:"user"`
// SDcard is a base path to block device of sdcard.
diff --git a/dryad/conf/conf_test.go b/dryad/conf/conf_test.go
index c0b2142..f1f7177 100644
--- a/dryad/conf/conf_test.go
+++ b/dryad/conf/conf_test.go
@@ -20,6 +20,7 @@ import (
"bytes"
"strings"
+ "git.tizen.org/tools/boruta"
. "git.tizen.org/tools/boruta/dryad/conf"
. "github.com/onsi/ginkgo"
@@ -31,12 +32,15 @@ var _ = Describe("Conf", func() {
boruta_address = ""
sdcard = "/dev/sdX"
+[caps]
+
[user]
name = "boruta-user"
groups = []
`
unmarshaled := &General{
Address: ":7175",
+ Caps: boruta.Capabilities(map[string]string{}),
User: &User{
Name: "boruta-user",
Groups: []string{},